Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 935cd31

Browse files
committed
make skip also skip with pytest
1 parent ba8924b commit 935cd31

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

IPython/testing/decorators.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,14 @@ def onlyif_cmds_exist(*commands):
376376
Decorator to skip test when at least one of `commands` is not found.
377377
"""
378378
for cmd in commands:
379+
reason = "This test runs only if command '{cmd}' is installed"
379380
if not shutil.which(cmd):
380-
return skip("This test runs only if command '{0}' "
381-
"is installed".format(cmd))
381+
if os.environ.get("IPTEST_WORKING_DIR", None) is not None:
382+
return skip(reason)
383+
else:
384+
import pytest
385+
386+
return pytest.mark.skip(reason=reason)
382387
return null_deco
383388

384389
def onlyif_any_cmd_exists(*commands):

0 commit comments

Comments
 (0)