Skip to content

Test Explorer doesn't show icon next to tests that have an 'Unknown' status. #4578

@d3r3kk

Description

@d3r3kk

Environment data

  • VS Code version: 1.31.1
  • Extension version (available under the Extensions sidebar): 2019.2.5433
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.0
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: pytest

Expected behaviour

All test nodes report their status visually in the Test Explorer after running them.

Actual behaviour

Test nodes that return a status of 'Unknown' do not show an icon next to them after a test run completes.

Steps to reproduce:

  1. Clone, open, and configure Python/pytest, the Pytest repo in VS Code with the Python extension installed.
    • Once the VS Code editor and the Python extension load, the Test Explorer beaker icon should appear in the activity bar.
  2. Run all tests.
  3. Inspect the test results in the Test Explorer tree.

Files affected

src\client\unittests\explorer\testTreeViewItem.ts
See the method getIconPath...

    public get iconPath(): string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon {
        if (!this.data) {
            return '';
        }
        const status = this.data.status;
        switch (status) {
            case TestStatus.Error:
            case TestStatus.Fail: {
                return getIcon(Icons.failed);
            }
            case TestStatus.Pass: {
                return getIcon(Icons.passed);
            }
            case TestStatus.Discovering:
            case TestStatus.Running: {
                return getIcon(Icons.discovering);
            }
            default: {
                switch (this.testType) {
                    case TestType.testFile: {
                        return ThemeIcon.File;
                    }
                    case TestType.testFolder: {
                        return ThemeIcon.Folder;
                    }
                    default: {
                        return '';
                    }
                }
            }
        }
    }

If you place a breakpoint on the very last default case's return statement you will capture the point where Unkown status is being returned.

Metadata

Metadata

Labels

area-testingbugIssue identified by VS Code Team member as probable bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions