version.py: add comment with workaround to run pytest from scratch.#925
version.py: add comment with workaround to run pytest from scratch.#925marc-hb wants to merge 1 commit intozephyrproject-rtos:mainfrom
Conversation
importlib.metadata.version("west") requires a west package.
After a surprisingly long time, I realized there's none when
running pytest from scratch. That's because (un)installations seem to
always leave one behind. So this "accidentally" tends to work.
As a workaround, recommend the very well tried and tested tactic of...
installing - and uninstalling.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #925 +/- ##
==========================================
- Coverage 86.01% 85.95% -0.06%
==========================================
Files 11 11
Lines 3453 3453
==========================================
- Hits 2970 2968 -2
- Misses 483 485 +2
|
How exactly do you get into this situation? |
Easy: |
Emphasis in case you missed this.
"All problems in computer science can be solved by another level of indirection." "Except for too many layers of indirection!" |
|
What about maintaining the version in the python code and setuptools will read it from there? |
I'm really not a packaging expert but LGTM. In fact, having the version in a file called What is the "best practice" for this? Assuming there is one... |
Clicking on the link in the version.py file leads to https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata which describes the changes from @thorsten-klein It would be a cleaner solution definitely. |
importlib.metadata.version("west")requires a west package. After a surprisingly long time, I realized there's none when running pytest from scratch. That's because (un)installations seem to always leave one behind. So this "accidentally" tends to work. As a workaround, recommend the very well tried and tested tactic of... installing - and uninstalling.cc: @thorsten-klein