Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pytest Tooling] Eliminate spurious Pytest warnings about unregistered marks #2745

Open
jaywritescode opened this issue Nov 9, 2021 · 10 comments
Labels
bug 🐛 on hold ✋🏽 Action should stop on this issue or PR for now. smolder🍲 Lower-priority and/or future idea

Comments

@jaywritescode
Copy link

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?

@github-actions

This comment has been minimized.

@jaywritescode
Copy link
Author

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.

@BethanyG
Copy link
Member

BethanyG commented Nov 10, 2021

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.

@BethanyG
Copy link
Member

Flagging this as a bug, since we haven't (yet) figured out how to get this to download with the CLI.

@BethanyG
Copy link
Member

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.

@BethanyG
Copy link
Member

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.

@BethanyG BethanyG changed the title Eliminate spurious Pytest warnings about unregistered marks [Pytest Tooling] Eliminate spurious Pytest warnings about unregistered marks Jan 21, 2022
@BethanyG
Copy link
Member

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.

BethanyG added a commit to BethanyG/python that referenced this issue Mar 30, 2022


* added the pytest invokation pytest -o markers=task to the "running tests" sections of exercises/shared/test.md and docs/TESTS.md
* updated and clarified INSTALLATION.md
* updated and added new resources to LEARNING.md
* updated and added new resources to RESOURCES.md
* overhauled TOOLS.md and added new editors and links
BethanyG added a commit to BethanyG/python that referenced this issue Mar 30, 2022


* added the pytest invokation pytest -o markers=task to the "running tests" sections of exercises/shared/test.md and docs/TESTS.md
* updated and clarified INSTALLATION.md
* updated and added new resources to LEARNING.md
* updated and added new resources to RESOURCES.md
* overhauled TOOLS.md and added new editors and links
BethanyG added a commit that referenced this issue Mar 30, 2022
* added the pytest invokation pytest -o markers=task to the "running tests" sections of exercises/shared/test.md and docs/TESTS.md
* updated and clarified INSTALLATION.md
* updated and added new resources to LEARNING.md
* updated and added new resources to RESOURCES.md
* overhauled TOOLS.md and added new editors and links
@BethanyG
Copy link
Member

BethanyG commented May 6, 2022

@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! 😄

@ErikSchierboom
Copy link
Member

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)

@BethanyG BethanyG added the on hold ✋🏽 Action should stop on this issue or PR for now. label May 21, 2022
@BethanyG
Copy link
Member

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.

@BethanyG BethanyG added the smolder🍲 Lower-priority and/or future idea label May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 on hold ✋🏽 Action should stop on this issue or PR for now. smolder🍲 Lower-priority and/or future idea
Projects
None yet
Development

No branches or pull requests

3 participants