Skip to content

Commit

Permalink
Don't import pytest globally
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf authored and pipermerriam committed May 29, 2018
1 parent 1612f2a commit 86e608c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion evm/tools/fixture_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import rlp

import pytest

from cytoolz import (
curry,
Expand Down Expand Up @@ -71,6 +70,18 @@ def find_fixture_files(fixtures_base_dir):
return all_fixture_paths


def import_pytest():
try:
import pytest
except ImportError:
raise ImportError(
'pytest is required to use the fixture_tests. Please ensure '
'it is installed.'
)
else:
return pytest


@to_tuple
def find_fixtures(fixtures_base_dir):
"""
Expand Down Expand Up @@ -108,6 +119,7 @@ def filter_fixtures(all_fixtures, fixtures_base_dir, mark_fn=None, ignore_fn=Non
if mark_fn is not None:
mark = mark_fn(fixture_relpath, *fixture_data[1:])
if mark:
pytest = import_pytest()
yield pytest.param(
(fixture_path, *fixture_data[1:]),
marks=mark,
Expand Down

0 comments on commit 86e608c

Please sign in to comment.