-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Rename test_... functions to avoid the naming scheme reserved by pytest #33549
Comments
comment:2
Good thing pycheck and pyright let us use |
This comment has been minimized.
This comment has been minimized.
Commit: |
Author: Tobias Diez |
Changed dependencies from #31924 to none |
comment:4
Yo should have a look at:
and
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:7
Testing with the command-line from the ticket description of #31924:
|
comment:8
There's a (trivial) merge conflict with #32975, best to merge in to make it easier to test. |
comment:9
Typo: |
Reviewer: Sebastian Oehms, Matthias Koeppe |
comment:13
Replying to @tobiasdiez:
Merging with #33550 I had to resolve some conflics. So I think it would make sence to have it here as dependency. Im not really familiar with Together with #33550 the behavior with respect to
Are these expected? |
comment:34
In #31924 comment:43, Matthias argues that
I agree with him that these test-related methods should have been private from the get-go. Especially since most of them contain an explicit disclaimer ala "this is intended only for usage in doctests". But if you really have issues with the rename and think it's the right procedure, I can start a discussion on the mailing list. |
Changed branch from public/tests/pytest_wrong_test_methods to |
Changed branch from |
comment:37
Well tests work... let me know when it is ready to be merged. |
comment:39
Replying to @tobiasdiez:
It does not matter what they should have been, just what they are.
Yes: comment:33 |
comment:40
Instead of a policy discussion, perhaps can we move the ticket forward by setting up deprecated aliases for the renamed functions. |
comment:41
I strongly think we should not give any package, much less an optional package, any priority over names of public functions without a very good reason. I am also not convinced that we want to move forward with pytest becoming standard either. Both of these need to be discussed on sage-devel, with the first issue for this ticket. You cannot sidestep this. Deprecating the functions is efffectively the same as renaming them as it marks a major policy change. |
comment:42
Well, function names that are generic. If they are sufficiently unique to the package, then that is fine with me. |
comment:43
All of them are unique to the module that they are defined in, and their purpose is to support doctests in the same module. Renaming them from |
comment:44
Yes, but that is a non sequitur. I agree that renaming them (with deprecation) is within the current policy, but it is the reason for these changes that is the issue. It is about the conflict with an optional package's conventions that are fully reserve a certain class of (natural) function names. Enforcing this (which is done here across the entire Sage library) would give |
comment:45
I have split out #33612 for the strategy proposed in comment:40, comment:43. As you will see in the ticket description, it is an improvement to the Sage library independent from its motivation for pytest. |
comment:47
Thanks Matthias! |
sage -t
throws errors on some files because pytest is configured to look for methods prefixed withtest_
and treats them as pytest test functions/methods, which are then executed. However, sage's code base contains some functions that match this pattern without being pytests.This leads to problems like
We fix it in this ticket as follows:
test_xyz
to_test_xyz
(which also marks them as private)See #31924 for further discussion on different approaches to fix the same issue including their pros and cons.
This is preparation for #33546.
Depends on #32975
Depends on #33612
Depends on #33617
CC: @tobiasdiez
Component: refactoring
Author: Tobias Diez
Branch/Commit: public/tests/pytest_wrong_test_methods @
7644854
Reviewer: Sebastian Oehms, Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/33549
The text was updated successfully, but these errors were encountered: