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.

Testing with pytest always issues a file not found error

See original GitHub issue

Whenever I run the tests, I always getting this strange error: Detail: Unable to read file (Error: File not found image I really don’t have a c file in my project. But where is it coming from?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
vistatestcommented, Sep 2, 2019

Not sure if it the same bug or not. Getting File not found on Mac OS for pytest when click on shaded Run Test above the test. The file and the test obviously exist. Error is below.

============================= test session starts ==============================
platform darwin -- Python 3.7.3, pytest-5.0.1, py-1.8.0, pluggy-0.12.0
rootdir: /Users/vistatest/Git/vista
plugins: postgresql-1.4.0, flask-0.14.0, mock-1.10.4, flask-sqlalchemy-1.0.2
collected 0 items

- generated xml file: /var/folders/lv/_hsxgz4926343l7tn7tc43wm0000gn/T/tmp-1213osfyIlUdGERC.xml -
========================= no tests ran in 0.01 seconds =========================
ERROR: file not found: ./git_work/test_fsrepo.py::test_fsrepo_local_stats
3reactions
karrtikrcommented, Sep 25, 2019

@luabud I can confirm that if test directory contains an pytest.ini, and file path for the files in the test directory are being incorrectly calculated while running tests.

For eg. Expected path: c:\Users\luabud\Apps\vscode\tests\two\test_d.py Actual path: c:\Users\luabud\Apps\vscode\two\test_d.py

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileNotFoundError when using python -m pytest vs. pytest
When I launch my virtual environment I am sitting at the root of this directory structure. I run my tests by issuing this...
Read more >
ERROR: file or directory not found: tests/* - Atlassian Community
The error indicates that the tests folder does not exist in the repository. The pytest command expects to find files with tests in...
Read more >
Python Testing with pytest, Second Edition: File not Found ...
I ran this command after installing the sample application: $ cards add do something --owner Brian. And got a file not found error:....
Read more >
Basic patterns and examples — pytest documentation
Sometimes a test session might get stuck and there might be no easy way to figure out which test got stuck, for example...
Read more >
Effective Python Testing With Pytest
To follow along with some of the examples in this tutorial, you'll need to install pytest . As most Python packages, pytest is...
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