Conversation
| import pytest | ||
| from conftest import cmd | ||
|
|
||
| assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox" |
There was a problem hiding this comment.
Ha, I'm finally understanding the "detox" pun :-)
This would be great: because of too many layers, so far my only solution to run a test in a debugger was PUDB_TTY. It worked... only most of the time!
Don't forget to update b7e091d
There was a problem hiding this comment.
Unless... the uv replacement merely substitutes another layer of indirection, still getting in the way and still making it hard to run a test in a debugger directly?
Sorry for thinking out loud. Hey it's just a draft PR ;-)
There was a problem hiding this comment.
I want to reduce the layering too, it should be possible to run pytest directly IMO. uv is an optional utility, but I do want to make it the default for running in CI.
2fc8686 to
c88bc8c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #845 +/- ##
=======================================
Coverage 84.52% 84.52%
=======================================
Files 11 11
Lines 3366 3366
=======================================
Hits 2845 2845
Misses 521 521 |
e799cb8 to
d25a17e
Compare
3e0c3f2 to
57bbf11
Compare
|
@thorsten-klein, as you're actively developing for west, would you mind sharing your opinion (if you have any) on this PR? |
|
@pdgendt Nice! Looking forward towards easier debugging of west tests. It seems that with this change pytest can be directly run 👍 |
Allow running tests without tox, so remove the check for a tox environment. Signed-off-by: Pieter De Gendt <[email protected]>
Specify compatible versions for the dependencies, allowing minor and patch updates, while preventing major updates. Signed-off-by: Pieter De Gendt <[email protected]>
Add dependencies for different development groups. The groups are - lint: Linter tools - test: Pytest and coverage tools - types: Type checking tools Signed-off-by: Pieter De Gendt <[email protected]>
Copy mypy options from tox.ini into pyproject.toml. Signed-off-by: Pieter De Gendt <[email protected]>
Add poethepoet as a development dependency and add tasks for testing. Signed-off-by: Pieter De Gendt <[email protected]>
Generate a pinned version of the project dependencies. Signed-off-by: Pieter De Gendt <[email protected]>
Add generated files to omit in the coverage report. Signed-off-by: Pieter De Gendt <[email protected]>
Use uv to install all pinned dependencies and poethepoet as task runner. Signed-off-by: Pieter De Gendt <[email protected]>
Remove the tox configuration file. It's replaced with uv to manage installations of dependencies and the environment. Together with a simple task runner from poethepoet we can provide shortcuts for users during development. Signed-off-by: Pieter De Gendt <[email protected]>
Remove mentions of tox in the README and MAINTAINERS file. Update with poethepoet and uv alternatives. Signed-off-by: Pieter De Gendt <[email protected]>
Let dependebot check for Python updates on a monthly basis. Signed-off-by: Pieter De Gendt <[email protected]>
|
I had a try today and I was not able to run pytest directly. It seems that following points need to be tackled:
I will have a closer look tomorrow 👍 |
marc-hb
left a comment
There was a problem hiding this comment.
Minor comments that can all be addressed later.
I downloaded this and gave it good try and it felt great. Running pytest is especially easier. Thanks @pdgendt, not the least for forcing me to discover uv. It was worth it. Also, now I feel rejuvenated: like I belong to the cool kids!
| - name: Run tox | ||
| run: tox -c 'check out' -- -W error | ||
| - name: Run tasks | ||
| run: uv run --frozen --directory "./check out/" poe all |
There was a problem hiding this comment.
Could you not run "all" here to provide finer-grained results? And durations.
There was a problem hiding this comment.
This is close to what tox did, so I'll leave it for now. I think we should split indeed, but also reduce the matrix a bit. We don't need to run the linter task 15 times. Will follow-up!
There was a problem hiding this comment.
Submitted in:
There was a problem hiding this comment.
This new version of the README.rst seems to hesitate between embracing the new uv and poe approaches for "advanced" developers and sticking to the old pip ways for more basic stuff... I feel like this could needs more review time but I don't have that now. As long as all the examples were tested and do work, then good enough for now! Can be polished later after merging this. The README.rst tail should not wag the uv dog and delay this.
There was a problem hiding this comment.
I wanted to keep options open for developers.
BTW, I intend to re-vamp the readme together with moving the docs from Zephyr to a West site, and create a dedicated page for testing west itself.
There was a problem hiding this comment.
Big doc move WIP in:
There was a problem hiding this comment.
I hate mixing generated and non-generated files in the same git repo but who am I to question the wisdom of the new Youvee religion?
| - name: Install tox | ||
| run: pip3 install tox --break-system-packages | ||
| - name: Install uv | ||
| run: pip3 install uv --break-system-packages |
There was a problem hiding this comment.
GH runners are ephemeral so it does really matter but... just for better "role-modelling" maybe?
| run: pip3 install uv --break-system-packages | |
| run: pipx install uv |
Only if pipx is available by default, otherwise forget it.
Maybe not directly yet, but you can |
It's a bit tricky, as we want to test an installment, rather than the sources directly? Not sure if the difference is even noticeable? We can document an
Sure, we can improve on this, I'm going to go ahead with merging as this is a good basis IMO. |
Sounds good. I will then open the follow-up PR with my changes to run pytest directly 👍 |
| - name: Run tox | ||
| run: tox -c 'check out' -- -W error | ||
| - name: Run tasks | ||
| run: uv run --frozen --directory "./check out/" poe all |
There was a problem hiding this comment.
Submitted in:
There was a problem hiding this comment.
Big doc move WIP in:
Remove the tox dependency, which allows to run the testing directly or with other tasks runners (here using
poethepoet).In CI (can be used locally too) we use
uvto install and manage dependencies. Auv.lockfile has pinned dependencies.Some benefits of using
uv:Check individual commits for details.