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

Pytest Style: test_imports.py #1473

Merged
merged 2 commits into from Jul 11, 2017
Merged

Conversation

utkbansal
Copy link
Member

Fixes #

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Looking good, just minor things.

if self.is_excluded(fpath):
continue
yield self._run_test_relative_import, fpath
# yield self._run_test_relative_import, fpath
Copy link
Member

Choose a reason for hiding this comment

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

remove the commented line

return paths


@pytest.mark.parametrize('testing_module', get_file_paths())
Copy link
Member

Choose a reason for hiding this comment

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

looks like a sensible and pretty clean way to turn the yield-based test into a parametrized one, good!

Copy link
Member

Choose a reason for hiding this comment

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

(nothing to do here...)

Copy link
Contributor

Choose a reason for hiding this comment

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

It is rather neat indeed!


path_to_testing_modules = MDAnalysisTests.__path__[0]
# Exclusion path relative to MDAnalysisTests
exclusions = ['/plugins']
Copy link
Member

Choose a reason for hiding this comment

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

Also add '/data' to exclusions – will save a tiny bit in the os.walk and makes clear that nothing in the data directory should be looked at. (There are no .py files in data so nothing changes overall anyway.)

@utkbansal
Copy link
Member Author

@kain88-de @richardjgowers Review please.


path_to_testing_modules = MDAnalysisTests.__path__[0]
# Exclusion path relative to MDAnalysisTests
exclusions = ['/plugins', '/data']
Copy link
Contributor

Choose a reason for hiding this comment

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

Constants in the global scope should be in capital. PATH_TO_TESTING_MODULES and EXCLUSIONS. I'd like to see this changed but it is not blocking.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'd have preferred this too, it makes it obvious where things have come from

return paths


@pytest.mark.parametrize('testing_module', get_file_paths())
Copy link
Contributor

Choose a reason for hiding this comment

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

It is rather neat indeed!

@kain88-de kain88-de merged commit 5a1b55c into MDAnalysis:develop Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants