-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Add running doctest to pytest default #7840
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
Add running doctest to pytest default #7840
Conversation
Can you please run |
pytest.ini
Outdated
[pytest] | ||
markers = | ||
mat_ops: mark a test as utilizing matrix operations. | ||
addopts = --durations=10 | ||
addopts = --durations=10 --doctest-modules --doctest-continue-on-failure --showlocals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave out continue on failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the story behind that?
Usually, it's great to see all problems at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONTRIBUTING.md describes how contributors can run the test on their own computers. This is much preferred to commits to the repo that send repeated notifications to maintainers. We have 200+ open PRs so we need to reduce interrupts.
I question the utility of coverage -- It generates a TON of output on every test run and no one reads it. All this clutter makes it very difficult (and a lot of scrolling!) for first-time contributors to find their error messages in our GitHub Actions output. If someone really wants to understand the holes in test coverage, they can run it on their own computers and on their own time. |
Totally agree, I just noticed that it exists by accident. If tests pass I won't go to see action logs. Maybe some aggregator similar to pre-commit.ci could help with it. I have never used such tools. https://about.codecov.io/pricing/ There are a bunch of GitHub actions that work with coverage. Need to do a bit of experimenting with that https://github.com/marketplace?type=actions&query=python+coverage+ |
pytest.ini
Outdated
[pytest] | ||
markers = | ||
mat_ops: mark a test as utilizing matrix operations. | ||
addopts = --durations=10 | ||
addopts = --durations=10 --doctest-modules --doctest-continue-on-failure --showlocals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONTRIBUTING.md describes how contributors can run the test on their own computers. This is much preferred to commits to the repo that send repeated notifications to maintainers. We have 200+ open PRs so we need to reduce interrupts.
This is the same report but a bit more detailed.
def foo():
"""
int(1)
>>> 2
int(2)
>>> 3
"""
|
i have moved pytest and coverage setting to pyproject.toml and return |
pyproject.toml
Outdated
markers = [ | ||
"mat_ops: mark a test as utilizing matrix operations.", | ||
] | ||
addopts = "--durations=10 --doctest-modules --doctest-continue-on-failure --showlocals" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have a list of strings instead if that's possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Describe your change:
Add default arguments to pytest.ini. This helps when you want to test your code locally.
Checklist:
Fixes: #{$ISSUE_NO}
.