GithubHelp home page GithubHelp logo

Comments (2)

karthiknadig avatar karthiknadig commented on August 15, 2024

@broganrossae We only do that in the logs, actual execution uses full path that you provide. Would it be possible to share the error that you see when discovery fails?

from vscode-python.

broganrossae avatar broganrossae commented on August 15, 2024

I'm working on repositories with non-standard layouts, and because of that I need to set the PYTHONPATH env var to help pytest find the correct modules. Therefore the errors I get are ModuleNotFoundErrors.
In a separate shell I ran the example pytest commands (in the same working dir). One with ~ and one with the absolute path to user's home directory. When using ~ they failed, but the absolute path worked, which is what makes me think the plugin isn't using ~ only in logs.

Error stack example with truncated/redacted stuff

2024-06-03 09:11:07.154 [info] ============================= test session starts ==============================
platform darwin -- Python 3.11.9, pytest-7.4.4, pluggy-1.5.0

2024-06-03 09:11:07.162 [info] rootdir: /Users/user.name/repos/repoName
configfile: pytest.ini
plugins: mock-3.11.1

2024-06-03 09:11:07.506 [info] collected 28 items / 4 errors

<Package unit>
  <Module test_file_one.py>
    <Function test_one>
    <Function test_two>
    <Function test_three>

2024-06-03 09:11:07.533 [error] pytest test discovery error for workspace:  /Users/user.name/repos/repoName 
 _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/user.name/repos/repoName/tests/unit/test_another.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/unit/test_EXT03_05.py:11: in <module>
    import EXT03_05_prepareSendFiles as preset
presets/EXT03_05_prepareSendFiles.py:9: in <module>
    import EXT03_00_config as config
E   ModuleNotFoundError: No module named 'EXT03_00_config'
 Check Python Test Logs for more details.


2024-06-03 09:11:07.535 [info] =========================== short test summary info ============================
ERROR tests/unit/test_another.py
!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!
==================== 28 tests collected, 4 errors in 0.38s =====================

2024-06-03 09:11:07.574 [error] Subprocess exited unsuccessfully with exit code 2 and signal null on workspace /Users/user.name/repos/repoName.
2024-06-03 09:11:07.574 [error] Subprocess exited unsuccessfully with exit code 2 and signal null on workspace /Users/user.name/repos/repoName. Creating and sending error discovery payload
2024-06-03 09:11:07.574 [error] pytest test discovery error for workspace:  /Users/user.name/repos/repoName 
  
 The python test process was terminated before it could exit on its own, the process errored with: Code: 2, Signal: null for workspace /Users/user.name/repos/repoName

from vscode-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.