[Pytest Tooling] Eliminate spurious Pytest warnings about unregistered marks
When running the test suites for a Python exercise in a local environment, Pytest generates a set of warnings because each of the tests is annotated (decorated) with @pytest.mark.task. Because task isn't registered, the Pytest output includes lines such as
dicts_test.py:50
/Users/xyz/Exercism/python/inventory-management/dicts_test.py:50: PytestUnknownMarkWarning: Unknown pytest.mark.task - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
@pytest.mark.task(taskno=4)
This output is noisy and of little value to the developer.
Would it be reasonable to add a pytest.ini or pyproject.toml file as described in the link above to each of the exercises?
🤖 🤖
Hi! 👋🏽 👋 Welcome to the Exercism Python Repo!
Thank you for opening an issue! 🐍 🌈 ✨
- If you are requesting support, we will be along shortly to help. (generally within 72 hours, often more quickly).
- Found a problem with tests, exercises or something else?? 🎉
We'll take a look as soon as we can & identify what work is needed to fix it. (generally within 72 hours).
- If you'd also like to make a PR to fix the issue after discussing it,
We 💙 PRs that follow our Exercism & Track contributing guidelines!
- Here because of an obvious (and small set of) spelling, grammar, or punctuation issues with one exercise,
concept, or Python document?? 🌟Please feel free to submit a PR, linking to this issue.🎉
❗ Please do not run checks on the whole repo & submit a bunch of PRs.
This creates longer review cycles & exhausts reviewers energy & time.
It may also conflict with ongoing changes from other contributors.
For anything complicated or ambiguous, let's discuss things -- we will likely welcome a PR from you.
❗ Please keep in mind that inserting only blank lines, making a closing bracket drop to the next line, changing a
word to a synonym without obvious reason, adding trailing space that's not a EOL for the very end of text files,
and other "changes just to change things" are not considered helpful, and will likely be closed by reviewers.
💙 While you are here... If you decide to help out with other open issues, you have our gratitude 🙌 🙌🏽.
Anything tagged with [help wanted] and without [Claimed] is up for grabs.
Comment on the issue and we will reserve it for you. 🌈 ✨
Here to suggest a feature or new exercise?? Hooray! 🎉 Please keep in mind Chesterton's Fence.
Thoughtful suggestions will likely result faster & more enthusiastic responses from maintainers.
Taking a second look, there is the appropriate pytest.ini file in this repo; however, it's not being copied into the individual exercise packages.
Hi @jaywritescode,
Thanks for logging this issue. The warnings should vanish if you place the ini file in the root of the exercise folder (e.g. under python/. You shouldn't need a copy in the individual exercise folders. We're investigating why it isn't currently downloading with the exercises.
Additionally, you can run pytest with pytest -o markers=task or use the PYTEST_ADOPTS env var to get the warnings to disappear.
Flagging this as a bug, since we haven't (yet) figured out how to get this to download with the CLI.
After discussing this with @ErikSchierboom, the ultimate resolution will be to place our pytest.ini file in python/exercises/shared/, so that it can be dowloaded via the CLI.
However, that download behavior is not yet supported, so in the interim, we will have setup notes/instructions for students to download the file from the repo to copy into their root python/ folder, or have them create an ini file in that location.
via PR #2806, made a copy of the pytest.ini file in exercises/shared. Testing docs have been updated. Once the file is downloadable via CLI, we can close this issue.
Linking closed issue #2539, as the documentation is still not ideal around this issue. Will be opening separate issues for updating documentation to make it clearer what needs to happen for students to set this up properly.
@ErikSchierboom -- tagging you because we discussed a while ago having the pytest.ini download via the CLI, and I'm not sure where we are on that front. (no worries if there is a delay -- I just don't want to forget about it.)
I have updated our testing documentation, and that has helped with this issue a lot -- but would also love to have the config file available via CLI in exercises/shared if possible... just let me know. Thanks! 😄
Yeah, sorry, that has not yet been implemented. I'll let you know when I get to that (such a huge list of TODOs :D)
Tagging this as officially "on hold" for the auto-download option. Since we've changed the docs to clarify, this feels somewhat lower-priority at this stage.