-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
When I pip install importnb
individual pytests run twice.
This is quite weird behavior, because importing importnb isn't required. All you have to do is pip install it and tests start running twice. When uninstalling importnb the issue goes away.
To reproduce:
cd /tmp/
mkdir project
cd project/
python3 -m venv .venv
source .venv/bin/activate
pip install pytest
mkdir tests
cd tests/
vim test.py
def test_empty():
...
pytest test.py -k test_empty
================================================ test session starts =================================================
platform linux -- Python 3.11.10, pytest-8.3.3, pluggy-1.5.0
rootdir: /tmp/project/tests
collected 1 item
test.py . [100%]
================================================= 1 passed in 0.00s ==================================================
pip install importnb
pytest test.py -k test_empty
================================================ test session starts =================================================
platform linux -- Python 3.11.10, pytest-8.3.3, pluggy-1.5.0
rootdir: /tmp/project/tests
plugins: importnb-2023.11.1
collected 2 items
test.py .. [ 50%]
================================================= 2 passed in 0.01s ==================================================
Note: I've tested this with Python 3.11, 3.12, and 3.13. I've also tested it with pytest 8.3 and 8.2. This is reproducible both in PyCharm and in the command line.
Also, it doesn't work with the current version from github:
pytest test.py -k test_empty
================================================ test session starts =================================================
platform linux -- Python 3.11.10, pytest-8.3.3, pluggy-1.5.0
rootdir: /tmp/project/tests
plugins: importnb-2023.11.2.dev11+ga633de3
collected 2 items
test.py .. [ 50%]
================================================= 2 passed in 0.01s ==================================================
Metadata
Metadata
Assignees
Labels
No labels