test local worktree with pytest by default#884
test local worktree with pytest by default#884pdgendt merged 1 commit intozephyrproject-rtos:mainfrom
Conversation
42c3f00 to
1fb8293
Compare
marc-hb
left a comment
There was a problem hiding this comment.
No major concern, see below.
README.rst
Outdated
| # Manually (test the local copy) | ||
| pytest -o pythonpath=src | ||
| # Manually (test the installed west version) | ||
| pytest -o pythonpath= |
There was a problem hiding this comment.
Is this really needed? Packaging issues should already be found by uv.
Unless there's value in testing and older version with newer tests or vice-versa? Very "advanced" then. Maybe move this trick outside the README.rst, how about a comment just above the pythonpath = "src" line? So people don't assume they have to change that line.
There was a problem hiding this comment.
Yes, this is very advanced. It is a good idea to move it to pyproject.toml
|
|
||
| [tool.poe.tasks.test] | ||
| cmd = "python -m pytest -v -W error --junitxml=junit.xml -o junit_family=xunit1 --cov-report=html --cov-config=pyproject.toml --cov=west" | ||
| cmd = "python -m pytest -W error" |
There was a problem hiding this comment.
Do we need to lose the coverage options on this task?
There was a problem hiding this comment.
@pdgendt has proposed this change.
Maybe you missed it: This command is moved to uv run poe gh-test as those coverage files are most likely only needed in CI.
Do you see any benefit of creating the coverage files always on the user's local system on each uv run poe test?
There was a problem hiding this comment.
Arguments passed on the CLI are still possible, it's just not generated by default.
$ uv run poe test --cov-report=html --cov-config=pyproject.toml --cov=westI don't tend to look at coverage locally that often, so I like that it's now opt-in. We could provide a poe config option for it, but it's a bit overkill IMO.
|
I know we don't have a lot of pull requests but for the record and for reviewers who only give a hand from time to time, don't forget to mention that this is a better alternative to #883 where relevant discussion already happened. |
Enable pytest `pythonpath=src` by default to run tests against the local worktree (e.g. when invoked via `poe test`). An alternative task `poe gh-test` is added, which explicitly unsets `pythonpath` in order to test the installed package (run in CI within `uv` environment).
1fb8293 to
8c5f58a
Compare
|
@marc-hb any open comments here? |
Successor of #883 where this was discussed.
Enable pytest
pythonpath=srcby default to run tests against the local worktree.poe testnow also tests the local worktree.In CI, the newly added
poe gh-testis run in order to test the locally installed package (installed viauv).gh-testexplicitly unsets pytest optionpythonpathand creates a coverage report.During manual tests it was observed that
uvalways appends thesrcdirectory tosys.path. Luckily, this is not a problem as the path is appended and the path of the installed west comes first.