question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error running test with pytest

See original GitHub issue

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%

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:9
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
paaksingcommented, Aug 21, 2020

Still experiencing in vscode:

-- Docs: https://docs.pytest.org/en/stable/warnings.html
- generated xml file: C:\Users\Spanish\AppData\Local\Temp\tmp-1396govENRcMi0AS.xml -
======================== 1 passed, 7 warnings in 5.03s ========================
Error: Error: Illegal value for `line`

python 3.8 vscode 1.48

Fixed by Re-Discovering the tests

2reactions
brettcannoncommented, Jul 24, 2020

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error running test with pytest #4334 - microsoft/vscode-python
I have a simple test scenario which yields some errors in vs code. I'm trying to run the following little program with the...
Read more >
Usage and Invocations — pytest documentation
Pytest supports several ways to run and select tests from the command-line. ... This will run tests which contain names that match the...
Read more >
Module name not found error either while running python ...
1 Answer 1 · make sure you have an __init__.py file in test , src and tool directories · in test_main.py , import...
Read more >
Why does PyCharm not run pytest testing for my application?
I'm new to pytest and am trying to write testing modules for my application. My directory structure is: broker/ broker/tests...
Read more >
pytest usage - manpages.ubuntu!
Creating a URL for each test failure: pytest --pastebin=failed This will submit test run information to a remote Paste service and provide a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found