-
Notifications
You must be signed in to change notification settings - Fork 105
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
TST: Fix largescale pytest mark issue #1553
Conversation
We change the command-line option to a version recommended in the pytest docs: https://docs.pytest.org/en/latest/example/markers.html#custom-marker-and-command-line-option-to-control-test-runs - A global `suite(name)` mark is registered, that takes a name and marks a test as belonging to a specific suite. - These special suites are opt-in, i.e., not run by default. - To enable a suite, one adds `-S name` to the pytest command-line options. - Since function-scoped fixtures are handled stricter now, the workaround in tensors_test.py didn't work any longer (see pytest-dev/pytest#6497). - We thus set the minimum pytest version to 5.4.0, where the fix for the issue is implemented. Closes: odlgroup#1514
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.
Nice change, minor comments.
@@ -279,4 +282,4 @@ def test_proximal_convex_conj_kl_cross_entropy_solving_opt_problem(): | |||
|
|||
|
|||
if __name__ == '__main__': | |||
odl.util.test_file(__file__, ['--largescale']) | |||
odl.util.test_file(__file__, ['-S', 'largescale']) |
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.
Shouldn't '-S largescale'
be more appropriate?
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.
That's indeed how you give it on the command line. Here it's just a list of arguments to the call, and from what I've seen it's more common to give it in "already pre-parsed" form, i.e., each argument as a separate element of the list.
|
||
|
||
@pytest.mark.skipif("not pytest.config.getoption('--doctest-doc')", | ||
reason='Need --doctest-doc option to run') | ||
@pytest.mark.suite("doc_doctests") | ||
def test_file(doc_src_file): | ||
# FIXXXME: This doesn't seem to actually test the file :-( |
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.
Probably should be TODO :)
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.
Yeah, new issue I guess
@@ -8,21 +8,30 @@ | |||
|
|||
"""Test configuration file.""" | |||
|
|||
from __future__ import print_function, division, absolute_import | |||
import numpy as np | |||
from __future__ import absolute_import, division, print_function |
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.
Unrelated, but python 2 is no longer supported by the community. We could remove support for it in ODL.
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.
Yes definitely. I'll make an issue for that. Perhaps it's okay to say "this is the last commit that supports Python 2", rather than crafting a release for it.
We change the command-line option to a version recommended in
the pytest docs:
https://docs.pytest.org/en/latest/example/markers.html#custom-marker-and-command-line-option-to-control-test-runs
suite(name)
mark is registered, that takes aname and marks a test as belonging to a specific suite.
-S name
to the pytestcommand-line options.
the workaround in tensors_test.py didn't work any longer
(see Fixture fails with "module" scope and numpy array as value pytest-dev/pytest#6497).
fix for the issue is implemented.
Closes: #1514