-
-
Notifications
You must be signed in to change notification settings - Fork 673
Reenable pytest again as part of sage -t
#40446
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
base: develop
Are you sure you want to change the base?
Conversation
No idea about the failing tests in |
I guess the CI is invoking pytest via the |
Yes, pytest is called as part of |
Maybe you should retrigger the CI (e.g. by pushing an empty commit) just in case. |
sagemathgh-40474: Add pytest command to run tests in CI workflow <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Alternative to sagemath#40446. This time running pytest directly in the CI, instead of as part of `sage -t`. Removed one old test file that fails with meson since the sage cli is different then. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40474 Reported by: Tobias Diez Reviewer(s):
Documentation preview for this PR (built with commit ab4902b; changes) is ready! 🎉 |
sage -t
This is now finally working. @user202729 @orlitzky please have a look. (CI now actually runs the pytests twice: once as we call |
Hm… I'm not entirely sure what this does, it would be useful to explain what exactly does pytest run on. (methods start with Though it's probably better to answer this in a docstring or rst file edit instead of a comment. |
It's the same as running pytest directly. So, essentially This PR also doesn't introduce anything new. The functionality to run pytest as part of sage -t is there for some time, it just got broken/disabled by moving conftest.py to the root directory. |
I'm not entirely sure that's the right thing to do. Previously Plus does it work only from sage root, or any directory? |
Yes only _test files are passed on to pytest if you specify a file. To cite from the code:
|
The |
# they match the pytest file pattern. However, pass names | ||
# of directories. We use 'not os.path.isfile(f)' for this so that | ||
# we do not silently hide typos. | ||
filenames = [f for f in args.filenames |
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.
This is cute but we should probably use os.path.isdir() or not os.path.exists()
.
Aside from that one small refactoring for clarity, this LGTM, but I'm not sure if we should keep the separate |
Pytest used to run on as part of
sage -t
, but this is no longer the case. Here, we reactivate it by removing some safe-guards that are no longer necessary as pytest is a standard package now.Moreover, a "runtime error" due to a changing dict in an iteration is fixed in ae60cda.
📝 Checklist
⌛ Dependencies