Linked Questions

11 questions linked to/from pytest cannot import module while python can
0 votes
0 answers
47 views

I use pytest. I have a "kernel" folder in the root of the project in which the file is located "ecommerce.py" Full path "./kernel/ecommerce.py" I have a unit test that ...
stas stas's user avatar
  • 199
448 votes
29 answers
458k views

I used easy_install to install pytest on a Mac and started writing tests for a project with a file structure likes so: repo/ |--app.py |--settings.py |--models.py |--tests/ |--...
113 votes
18 answers
128k views

I want my tests folder separate to my application code. My project structure is like so myproject/ myproject/ myproject.py moduleone.py tests/ myproject_test.py myproject.py from ...
myol's user avatar
  • 10.1k
9 votes
3 answers
36k views

There were already questions regarding this topic. Sometimes programmers put some __init__.py at some places, often it is said one should use absolute paths. However, I don't get it to work here: How ...
1 vote
2 answers
2k views

I get the following error when running an azure pipeline. Here is the pytest part of my pipelines yaml file. steps: #test - task: UsePythonVersion@0 inputs: versionSpec: '$(python....
0 votes
2 answers
1k views

I use pybind11 to add a module _cxx to existing python library liba. The liba._cxx.func doesn't exist until I compile the c++ extension and install the whole library by setup.py. When I run tests in ...
R zu's user avatar
  • 2,074
1 vote
1 answer
735 views

I have been trying to craft some unit tests for pytest. The server runs just fine when I do 'python manage.py runserver'. However, when I do 'pytest', it shows the following error: ====================...
Nick's user avatar
  • 143
1 vote
1 answer
1k views

Running pytest in the terminal results in the below error. The application runs fine with python3 main.py from the src/ directory, however pytest throws this error. ...
Luca's user avatar
  • 131
1 vote
0 answers
494 views

I have been having a lot of trouble trying to run pytest. Basically the importing was not working properly. Let me explain. The folder structure of my project is the following: src └── api ├── ...
erni's user avatar
  • 77
0 votes
1 answer
725 views

I have a Python project set up with venv as the virtual environment (directory structure is attached below). When I try to run the tests with pytest (or python -m pytest tests or python -m pytest), I ...
1 vote
0 answers
213 views

I have one test, in the directory tests, when I run brownie test cannot import name 'PYTEST_COLLECT_MODULE' from '_pytest.deprecated' python version : 3.7.11