Skip to content

Pytest Style: test_deprecated.py - #1466

Merged
kain88-de merged 2 commits into
MDAnalysis:developfrom
utkbansal:deprecated
Jul 12, 2017
Merged

Pytest Style: test_deprecated.py#1466
kain88-de merged 2 commits into
MDAnalysis:developfrom
utkbansal:deprecated

Conversation

@utkbansal

Copy link
Copy Markdown
Member

Fixes #

Changes made in this Pull Request:

PR Checklist

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

try:
import MDAnalysis.core.units
except ImportError:
raise AssertionError("MDAnalysis.core.units not available")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe we should use pytest.fail here?

@jbarnoud

Copy link
Copy Markdown
Contributor

Couldn't all of these test move to one parametrized function?

Something in the lines of (from the top of my head, not even typed somewhere I could execute it):

@pytest.mark.parametrize('module', (
    'MDAnalysis.core.units',
    'MDAnalysis.core.util',
    'MDAnalysis.core.log',
    ...)
def test_import(module):
    try:
        importlib.import_module(module)
    except ImportError:
        raise AssertionError("{} not available".format(module))

@jbarnoud jbarnoud mentioned this pull request Jul 11, 2017
4 tasks

@kain88-de kain88-de left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please address the requested changes from @richardjgowers and @jbarnoud

@kain88-de
kain88-de merged commit 4398642 into MDAnalysis:develop Jul 12, 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.

5 participants