-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Generalize handling of resource-intensive tests #12350
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
Conversation
…on, and document how to write tests that need a lot of resources
Would any of the weekly crons be using the |
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.
Thanks, this looks very useful. Apart from the stylistic and usage notes, good to go in once the readthedocs failure is fixed.
Tests that have large disk and/or memory requirements | ||
==================================== |
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.
Tests that have large disk and/or memory requirements | |
==================================== | |
Tests that have large disk and/or memory requirements | |
===================================================== |
Sphinx warning/readthedocs failure
@pytest.mark.skipif(not os.getenv('TEST_INTENSIVE'), | ||
reason='Environment variable TEST_INTENSIVE must be ' | ||
'defined to run this test') |
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.
@pytest.mark.skipif(not os.getenv('TEST_INTENSIVE'), | |
reason='Environment variable TEST_INTENSIVE must be ' | |
'defined to run this test') | |
@pytest.mark.skipif(os.getenv('TEST_INTENSIVE', 0) == 0, | |
reason='Environment variable TEST_INTENSIVE must be defined to run this test') |
Just found that I intuitively expected the env var set to 0 to disable the tests; this would also be more consistent with how we are using the ASTROPY_USE_
vars (also noticed that setup is using os.environ.get()
, whatever the correct Zen is here ;-).
I prefer it without further linebreak, but unfortunately this would make the docs example break the line...
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.
I don't think we have any consistent zen in this department:
astropy/.github/workflows/ci_workflows.yml
Lines 11 to 13 in 73c57e1
env: | |
ARCH_ON_CI: "normal" | |
IS_CRON: "false" |
I would have named it SHOW_ME_THE_MONEY
but this works too.
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.
But those are checking the value as well.
TEST_INTENSIVE="False"
or TEST_INTENSIVE=0
did let the tests run.
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.
Re: values -- Yes, I agree with @dhomeier . The check should be more strict to only let it run when the value is 1, as documented.
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.
I'd be willing to allow anything that could be interpreted as True
, but in fact my suggestion will still accept 'false'
as well...
@@ -1014,8 +1014,8 @@ def test_read_big_table(tmpdir): | |||
assert len(t) == NB_ROWS | |||
|
|||
|
|||
@pytest.mark.skipif(not os.getenv('TEST_READ_HUGE_FILE'), | |||
reason='Environment variable TEST_READ_HUGE_FILE must be ' | |||
@pytest.mark.skipif(not os.getenv('TEST_INTENSIVE'), |
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.
@pytest.mark.skipif(not os.getenv('TEST_INTENSIVE'), | |
@pytest.mark.skipif(os.getenv('TEST_INTENSIVE', 0) == 0, |
Not sure about the changelog – do we generally include them for functionality only visible to developers? |
No, the GitHub actions workers don't have enough RAM |
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.
Deferring final review to @dhomeier , but this looks good to me!
Marked this as OK when readthedocs is fixed, but I think with @pllim there are at least 2 votes for checking |
No opinion here one way or the other. |
I think just checking if an environment variable is set or unset is enough, the value doesn't matter and having a complex condition in every test isn't ideal. |
+1 for markers, that's definitely the pytest tool for this job. |
I don't have much time to work on this so happy for someone to take the lead on pytest markers (and we can then close this PR) |
This looks very useful. I've been looking for something like this for the new cosmology test suite. |
Ideally, the pytest marker would be upstream from |
Closing in favor of #12764 . Thanks anyway! |
Description
This renames the environment variable for the big table tests to be more general and usable by other tests, and adds a tox option to more easily run these tests without setting an environment variable.
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
Extra CI
label.no-changelog-entry-needed
label. If this is a manual backport, use theskip-changelog-checks
label unless special changelog handling is necessary.astropy-bot
check might be missing; do not let the green checkmark fool you.backport-X.Y.x
label(s) before merge.