Skip to content

Commit af3f8bc

Browse files
committed
BUG: Remove pytest import from top of module
Move import to within the test function and change skip method
1 parent a514e0c commit af3f8bc

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

patsy/eval.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import tokenize
1919
import ast
2020
import numbers
21-
import pytest
2221
from patsy import PatsyError
2322
from patsy.util import PushbackAdapter, no_pickling, assert_no_pickling
2423
from patsy.tokens import pretty_untokenize, normalize_token_spacing, python_tokenize
@@ -424,14 +423,15 @@ def test_EvalEnvironment_subset():
424423
pytest.raises(NameError, subset_bc.eval, "a")
425424

426425

427-
@pytest.mark.skipif(
428-
sys.version_info >= (3, 13),
429-
reason=(
430-
"`frame.f_locals` may return write-through proxies in Python 3.13+, "
431-
"breaking direct comparison by ids."
432-
),
433-
)
434426
def test_EvalEnvironment_eq():
427+
import pytest
428+
429+
if sys.version_info >= (3, 13):
430+
pytest.skip(
431+
"`frame.f_locals` may return write-through proxies in Python 3.13+, "
432+
"breaking direct comparison by ids."
433+
)
434+
435435
# Two environments are eq only if they refer to exactly the same
436436
# global/local dicts
437437
env1 = EvalEnvironment.capture(0)

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ commands=
3232
pytest -vv --cov=patsy --cov-config={toxinidir}/.coveragerc --cov-report=term-missing --cov-report=xml --cov-report=html:{toxworkdir}/coverage/{envname} {posargs:}
3333
env PATSY_AVOID_OPTIONAL_DEPENDENCIES=1 pytest -vv --cov=patsy --cov-config={toxinidir}/.coveragerc --cov-report=term-missing --cov-report=xml --cov-report=html:{toxworkdir}/coverage/{envname} {posargs:}
3434
python {toxinidir}/tools/check-API-refs.py
35+
python -m pip uninstall pytest -y
36+
python -c "import patsy; print(patsy.__version__)"

0 commit comments

Comments
 (0)