Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 86e608c

Browse files
cburgdorfpipermerriam
authored andcommitted
Don't import pytest globally
1 parent 1612f2a commit 86e608c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

evm/tools/fixture_tests.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import rlp
99

10-
import pytest
1110

1211
from cytoolz import (
1312
curry,
@@ -71,6 +70,18 @@ def find_fixture_files(fixtures_base_dir):
7170
return all_fixture_paths
7271

7372

73+
def import_pytest():
74+
try:
75+
import pytest
76+
except ImportError:
77+
raise ImportError(
78+
'pytest is required to use the fixture_tests. Please ensure '
79+
'it is installed.'
80+
)
81+
else:
82+
return pytest
83+
84+
7485
@to_tuple
7586
def find_fixtures(fixtures_base_dir):
7687
"""
@@ -108,6 +119,7 @@ def filter_fixtures(all_fixtures, fixtures_base_dir, mark_fn=None, ignore_fn=Non
108119
if mark_fn is not None:
109120
mark = mark_fn(fixture_relpath, *fixture_data[1:])
110121
if mark:
122+
pytest = import_pytest()
111123
yield pytest.param(
112124
(fixture_path, *fixture_data[1:]),
113125
marks=mark,

0 commit comments

Comments
 (0)