Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
d3r3kk opened this issue Feb 27, 2019 · 3 comments
Closed
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug

Comments

@d3r3kk
Copy link

d3r3kk commented Feb 27, 2019

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.

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Feb 27, 2019
@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug needs PR area-testing labels Feb 27, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Feb 27, 2019
@DonJayamanne
Copy link

  • Modify getIconPath property in src/client/unittests/explorer/testTreeViewItem.ts
  • Create new icon (add dark and light themed icon into resources dir)
  • Add new enum to Icons in src/client/unittests/common/constants.ts

@brettcannon
Copy link
Member

This icon will represent both "unknown" -- i.e. immediately after discovery and before the first execution -- and "skipped" -- e.g. a test decorated with pytest.mark.skipIf. IOW all entries in the test explorer will always have a status icon.

@ericsnowcurrently
Copy link
Member

@luabud, we will need an icon (light and dark) for this. I've used a placeholder in my PR (#4635).

ericsnowcurrently added a commit that referenced this issue Mar 5, 2019
(for #4578)

Note: the icons are basic place-holders.
@ghost ghost removed the needs PR label Mar 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants