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

Remove global sage.all import in pytest #35598

Merged
merged 4 commits into from
May 28, 2023

Conversation

tobiasdiez
Copy link
Contributor

πŸ“š Description

Thanks to the recent advantages around sage.all imports (thanks @mkoeppe), we can remove the global sage.all import for pytests. This means that all pytests run now without this global import, and also the collection of tests is way quicker.

Of course, for doctests invoked by pytest the all import is still needed, so it's moved into the corresponding fixture.

πŸ“ Checklist

  • The title is concise, informative, and self-explanatory.
  • 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 accordingly.

βŒ› Dependencies

@mkoeppe
Copy link
Member

mkoeppe commented May 2, 2023

That would a pleasant surprise if this already works. But where do we see what tests were actually run by pytest? I have the suspicion that it's not running tests, because of the namespace package issue; in https://github.com/sagemath/sage/actions/runs/4863120862/jobs/8670370254?pr=35598, it says

============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-7.3.1, pluggy-1.0.0
rootdir: /__w/sage/sage/src
configfile: tox.ini
plugins: mock-3.10.0
collected 0 items / 1 skipped

@tobiasdiez
Copy link
Contributor Author

It was actually an issue with the pytest collection (the skip call for pyx files made it skip all files). This is fixed now. However, there are a few failing tests. Do you have an idea why the import of pyscipopt and cvxpy fail?

@mkoeppe
Copy link
Member

mkoeppe commented May 4, 2023

They are not standard packages, so not installed

@mkoeppe
Copy link
Member

mkoeppe commented May 4, 2023

Since these tests never ran, I probably didn't add the magic to conditionalize the tests. Could you help with this?

@tobiasdiez
Copy link
Contributor Author

Okay, thanks. Was easy enough to fix. So this is ready for review again (the failing doctest seems unrelated).

@github-actions
Copy link

github-actions bot commented May 4, 2023

Documentation preview for this PR is ready! πŸŽ‰
Built with commit: 2085480

Copy link
Member

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looking great. I've pushed a small change re the use of a variable from sage.env, which makes it better for downstream.

@tobiasdiez
Copy link
Contributor Author

Thanks for the review!

@vbraun vbraun merged commit 2096652 into sagemath:develop May 28, 2023
9 checks passed
@mkoeppe mkoeppe added this to the sage-10.1 milestone May 28, 2023
@tobiasdiez tobiasdiez deleted the pytest_allimport branch May 28, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants