From 02a9371259f651f17f38fc9f406eb43a0fcf2e2d Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Wed, 19 Oct 2022 22:28:51 -0400 Subject: [PATCH] adjust tests if py library is installed --- testing/_py/test_local.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testing/_py/test_local.py b/testing/_py/test_local.py index ceacd70ae..31c10b160 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -909,8 +909,12 @@ class TestExecution: assert out.find(x.basename) != -1 def test_sysexec_failing(self): + try: + from py._process.cmdexec import ExecutionFailed # py library + except ImportError: + ExecutionFailed = RuntimeError # py vendored x = local.sysfind("false") - with pytest.raises(RuntimeError): + with pytest.raises(ExecutionFailed): x.sysexec("aksjdkasjd") def test_make_numbered_dir(self, tmpdir): @@ -1146,7 +1150,10 @@ def test_pypkgdir_unimportable(tmpdir): def test_isimportable(): - from py.path import isimportable + try: + from py.path import isimportable # py vendored version + except ImportError: + from py._path.local import isimportable # py library assert not isimportable("") assert isimportable("x")