Importlib overwrites the path for my dir structure #13749
Unanswered
indiVar0508
asked this question in
Q&A
Replies: 1 comment 1 reply
-
i created a MRC https://github.com/indiVar0508/pytest-workspace-issue uv run pytest --import-mode=importlib -vvv
========================================================================== test session starts ===========================================================================
platform linux -- Python 3.10.12, pytest-8.3.5, pluggy-1.5.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/indivar/github/pytest-issue/repository
configfile: pyproject.toml
collected 2 items
sub-repo/bar/tests/test_main.py::test_foo PASSED [ 50%]
sub-repo/foo/tests/test_main.py::test_foo <- sub-repo/bar/tests/test_main.py PASSED [100%] this happens when i add __ init __.py in tests folder, if i remove it it works without overwritting it |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I have a monorepo, where I have following directory structure
I also have other mini packages which don’t follow src layout, I have added
—import-mode=importlib
in root pyproject for addoptsBut what I am seeing is test_main.py for pkg2 gets overwritten for pkg1 I.e. in test_main.py for pkg1 I have 3 test cases and in test_main.py for pkg2 I have 8 tests cases, but when I see in logs of pytest I see
From my understand and my guess is this is happening because when pytest resolves unique path for each it might be picking
tests.test_main
for both.I tried verbose run and I can see the test name from pkg1 in path of pkg2
I needed some help guidance / help to point me in right direction to properly setup this for my usecase
Thanks !
Beta Was this translation helpful? Give feedback.
All reactions