vscode-python: Error running test with pytest
Issue Type: Bug
I have a simple test scenario which yields some errors in vs code. I’m trying to run the following little program with the Python extension:
import os
import shutil
def test_something():
assert True == False
def setup_module(module):
""" setup any state specific to the execution of the given module."""
os.mkdir(".tmp")
os.chdir(".tmp")
def teardown_module(module):
""" teardown any state that was previously setup with a setup_module
method.
"""
os.chdir("../")
shutil.rmtree(".tmp")
I get the following two errors:
cannot open file:///home/erikah/ok/plattform/test/test_something.py. Detail: File not found (file:///home/erikah/ok/plattform/test/test_something.py)
This path seems to be wrong, given that the path to the program is /home/erikah/ok/plattform/python_testing/test
There was an error in running the tests. Running the test in the command line I get the following:
$ python3 -m pytest
================================================================================================================================== test session starts ===================================================================================================================================
platform linux -- Python 3.6.7, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: /home/erikah/ok/plattform/python_testing, inifile:
plugins: pylama-7.6.6
collected 1 item
test/test_something.py F [100%]
======================================================================================================================================== FAILURES ========================================================================================================================================
_____________________________________________________________________________________________________________________________________ test_something _____________________________________________________________________________________________________________________________________
def test_something():
> assert True == False
E assert True == False
../test/test_something.py:6: AssertionError
================================================================================================================================ 1 failed in 0.04 seconds ================================================================================================================================
Extension version: 2019.1.0 VS Code version: Code 1.31.0 (7c66f58312b48ed8ca4e387ebd9ffe9605332caa, 2019-02-06T08:51:24.856Z) OS version: Linux x64 4.15.0-45-generic
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-6700HQ CPU @ 2.60GHz (8 x 2700) |
GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: disabled_software surface_synchronization: enabled_on video_decode: unavailable_off webgl: enabled webgl2: enabled |
Load (avg) | 1, 1, 1 |
Memory (System) | 31.12GB (12.10GB free) |
Process Argv | –unity-launch |
Screen Reader | no |
VM | 0% |
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 16 (3 by maintainers)
Still experiencing in vscode:
python 3.8 vscode 1.48
Fixed by Re-Discovering the tests
We are going through old issues and we noticed that no one from the team had replied to this issue. I want to apologize for the oversight and to let you know that the issue was reviewed by the team and triaged (as shown by the labels applied to this issue).
I’m still experiencing this.
When using fixtures, where I run tests with temporary directories for instance, this happens.
@Almenon I believe they are different issues.