Skip to content

[BUG] testing within vscode #1395

@wutaomsft

Description

@wutaomsft

Description

Currently using vscode to discover test failed on the repository.

In which platform does it happen?

Tested on VSCode + ssh into DSVM, but should be reproducibe on all plaforms.

How do we replicate the issue?

In VSCode, click "Discover Tests" in the bottom bar, it would result in "test discovery failed". I have experienced two kind of errors by checking Python Test Log window.

  1. The first kind of errors is something like
    Test Discovery failed:
    Error: ImportError while loading conftest '/home/azureuser/src/recommenders/tests/conftest.py'.
    conftest.py:22: in
    from reco_utils.common.constants import (
    E ModuleNotFoundError: No module named 'reco_utils'
    Which can be addressed in where could I get the 'reco_utils' that imported in the code? #1065.

  2. The second kind of errors is something like
    import file mismatch:
    imported module 'test_notebooks_gpu' has this file attribute:
    /home/azureuser/src/recommenders/tests/integration/examples/test_notebooks_gpu.py
    which is not the same as the test file we want to collect:
    /home/azureuser/src/recommenders/tests/unit/examples/test_notebooks_gpu.py
    HINT: remove pycache / .pyc files and/or use a unique basename for your test file modules
    ________ ERROR collecting tests/unit/examples/test_notebooks_pyspark.py ________

According to https://stackoverflow.com/questions/12582503/test-discovery-failure-when-tests-in-different-directories-are-called-the-same, init.py are needed to different subirs. Will do a PR on this.

Expected behavior (i.e. solution)

Other Comments

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions