Multiple source roots #12908
Replies: 4 comments 6 replies
-
as there is a as far as i know, either |
Beta Was this translation helpful? Give feedback.
-
Your example works fine: $ mkdir -p gen src/python/mypackage tests
$ cat > src/python/mypackage/helper.py
def iter_pages(): pass
def next_link_cursor_extractor(): pass
$ cat > tests/test_stuff.py
from mypackage.helper import iter_pages, next_link_cursor_extractor
def test_something():
assert iter_pages() is None
$ cat > pyproject.toml
[tool.pytest.ini_options]
testpaths = [
"tests",
]
pythonpath = [
"gen",
'src/python',
]
$ pytest
============================= test session starts ==============================
platform linux -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/florian/tmp/12908
configfile: pyproject.toml
testpaths: tests
[...]
collected 1 item
tests/test_stuff.py . [100%]
============================== 1 passed in 0.01s =============================== But for starters, the traceback in your output does not match up with the example you show, so that's not what you're actually running. Please show a self-contained example that someone else can run easily, possibly as a small GitHub project or somesuch (make sure to run it as well, to make sure it actually exhibits the issue you're describing). |
Beta Was this translation helpful? Give feedback.
-
issue reproduction
|
Beta Was this translation helpful? Give feedback.
-
I'll change my project to copy the files into a single directory before testing. |
Beta Was this translation helpful? Give feedback.
-
I have a project with both hand-crafted and generated source files
when building dist package, everything from gen and src/python lands together, so no fancy namespace packages.
I'm trying to make pytest to treat the project in the same manner:
but
Beta Was this translation helpful? Give feedback.
All reactions