-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
sage.numerical.backends: Replace use of TestSuite by pytest #31103
Comments
comment:1
What should happen with the generic tests methods like |
comment:2
Great point. This brings me to the question whether it would be possible to either
|
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
|
Commit: |
This comment has been minimized.
This comment has been minimized.
comment:6
Replying to @mkoeppe:
That's a great idea, making it possible to step-by-step migrate more test methods without the need to do everything at once! I've used it now.
That might also work, but is more work since the |
comment:7
Thanks a lot! |
comment:8
Some quick remarks (I haven't had a chance to test it yet):
|
Author: Tobias Diez |
comment:10
Also, perhaps |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:12
Replying to @mkoeppe:
Thanks! Done. |
comment:13
Replying to @mkoeppe:
Mhh, pytest has its own test discovery bult-in, so I think its fine to just pass the path to it and let it look for the files. What advantages do you see of using a custom heuristic beforehand? |
comment:14
Replying to @tobiasdiez:
When pytest is not installed and you run But it should probably not warn if a user invokes |
comment:15
Shouldn't |
comment:16
Replying to @mkoeppe:
Good idea for later purposes. However, it doesn't remove the test_sage_unittest_testsuite method in GenericBackendTests since all backend tests ignore test_pickling, so this still has to be done there. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:18
Great. Could you add a docstring for We should also clarify whether |
comment:34
This version works for me |
comment:35
Replying to @tobiasdiez:
Yes, it did! |
comment:37
The only remaining problem that I have is that I need to update the 3 standalone packages providing additional backends (https://github.com/mkoeppe/sage-numerical-backends-coin, ...) to also invoke pytest - and to do make sure this does not cause errors on older Sage versions. |
comment:38
To keep the work limited, perhaps it's best to keep the old |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Matthias Koeppe, ... |
Changed author from Tobias Diez to Tobias Diez, Matthias Koeppe |
Changed reviewer from Matthias Koeppe, ... to Matthias Koeppe, Tobias Diez |
comment:41
Thanks a lot for having a look at this. Your changes look good to me! |
comment:42
Adding #30551 as a dependency because of |
Changed branch from public/refactoring/pytest-numerical-backends to |
Changed commit from |
comment:44
This seems to break our workflow at https://github.com/flatsurf/e-antic. We are running some SageMath doctests with
The problem is that this now returns with exit code 5, i.e., the CI assumes that the tests have failed. |
comment:45
A workaround is to drop a
|
comment:46
Help with fixing this properly is welcome. The developer who worked on the pytest stuff has disappeared |
comment:47
A proper fix would probably be to add an additional if check if the pytest return code is 5 here:
See also the discussion in pytest-dev/pytest#2393. I sadly don't have the time to implement it though. |
comment:48
The workaround in #31103 comment:45 does not work if the tested module contains some sage metaclass machinery since pytest is unvoked with In that case, there is an error and not only an error code 5.
|
comment:49
Another workaround is to just pretend that pytest is not installed:
But I actually think we should make this a bit more convenient than having to hack the module search path. |
comment:50
I guess the issue with the modules is the same as #31924. |
comment:51
And the exit code 5 issue should be fixed with #32892. |
sage.numerical.backends
provides an opportunity to study use ofpytest
as a replacement forTestSuite
(proposed in #30738) in a small self-contained codebase.GenericBackend
defines an API and a small number of_test_
methods to check that the API is implemented correctly by the backend implementations. We do this at the example of_test_ncols_nonnegative
, leaving the other test methods for follow-up tickets.Important design constraint:
sage_numerical_backends_coin
).This is accomplished by introducing a new
GenericBackendTests
class which defines the checks that should hold for all backend implementations. Then for each backend we introduce a class that derives fromGenericBackendTests
and returns in thebackend
test fixture the backend under test.The pytests are now also executed in
sage -t
after the doctests, e.g.bin/sage-runtests --verbose .
prints at the endDepends on #30901
Depends on #31003
Depends on #30551
CC: @tobiasdiez @nthiery @tscrim @fchapoton @yuan-zhou
Component: doctest framework
Author: Tobias Diez, Matthias Koeppe
Branch:
0592226
Reviewer: Matthias Koeppe, Tobias Diez
Issue created by migration from https://trac.sagemath.org/ticket/31103
The text was updated successfully, but these errors were encountered: