We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 88952d8 + 9d22500 commit 0ba2cfaCopy full SHA for 0ba2cfa
1 file changed
yt/testing.py
@@ -1245,7 +1245,15 @@ def skip(reason: str):
1245
def dec(func):
1246
@wraps(func)
1247
def wrapper(*args, **kwargs):
1248
- raise SkipTest(reason)
+ if os.getenv("PYTEST_VERSION") is not None:
1249
+ # this is the recommended way to detect a pytest session
1250
+ # https://docs.pytest.org/en/stable/reference/reference.html#envvar-PYTEST_VERSION
1251
+ import pytest
1252
+
1253
+ pytest.skip(reason)
1254
+ else:
1255
+ # running from nose, or unittest
1256
+ raise SkipTest(reason)
1257
1258
return wrapper
1259
0 commit comments