Repository navigation
Multiple source roots #12908
Unanswered
rafalkrupinski
asked this question in
Q&A
Replies: 4 comments 6 replies
|
as there is a as far as i know, either |
2 replies
|
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). |
4 replies
|
issue reproduction |
0 replies
|
I'll change my project to copy the files into a single directory before testing. |
0 replies
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.
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
All reactions