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

TST: Fix largescale pytest mark issue #1553

Merged
merged 8 commits into from
Apr 15, 2020

Conversation

kohr-h
Copy link
Member

@kohr-h kohr-h commented Apr 13, 2020

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 Fixture fails with "module" scope and numpy array as value pytest-dev/pytest#6497).
  • We thus set the minimum pytest version to 5.4.0, where the
    fix for the issue is implemented.

Closes: #1514

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
Copy link
Member

@adler-j adler-j left a 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'])
Copy link
Member

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?

Copy link
Member Author

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 :-(
Copy link
Member

Choose a reason for hiding this comment

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

Probably should be TODO :)

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

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.

@kohr-h kohr-h merged commit b6ed3bc into odlgroup:master Apr 15, 2020
@kohr-h kohr-h deleted the issue-1514__pytest_config branch April 15, 2020 07:32
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.

pytest.config deprecated and now failing
2 participants