summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Orling <timothy.t.orling@linux.intel.com>2016-10-05 23:56:52 -0700
committerTim Orling <timothy.t.orling@linux.intel.com>2016-10-06 00:07:10 -0700
commit86643307651879c8ce9e2a74630d1674a7110f22 (patch)
tree45f9247e024686a68564b612df81937494b56bba
parent0baaff3486da2f13aa65ab467e73f76b38d419f6 (diff)
downloadepel6-testing-container-86643307651879c8ce9e2a74630d1674a7110f22.tar.gz
epel6-testing-container-86643307651879c8ce9e2a74630d1674a7110f22.tar.xz
epel6-testing-container-86643307651879c8ce9e2a74630d1674a7110f22.zip
test_python34: fail and skip remaining tests if python3 is not installed
Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
-rw-r--r--tests/test_python34.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/test_python34.py b/tests/test_python34.py
index 2fd3179..4e4b5cf 100644
--- a/tests/test_python34.py
+++ b/tests/test_python34.py
@@ -21,10 +21,11 @@ from subprocess import Popen, PIPE
def python3_cli():
try:
- Popen("python3").communicate()[0]
- return True
- except OSError:
- pytest.fail("OSError: python3 not installed")
+ output = Popen("python3").communicate()[0]
+ return output
+ except:
+ pytest.mark.xfail("Error: python3 not installed")
+ finally:
return False
def python34_module(modulename):
@@ -34,33 +35,47 @@ def python34_module(modulename):
except:
pytest.fail("Error: python module %s not present" % modulename)
+
+class TestPython3Installed:
+
+ @pytest.fixture
+ def python3_cli(self):
+ try:
+ output = Popen("python3").communicate()[0]
+ return output
+ except:
+ pytest.mark.xfail("Error: python3 not installed")
+ finally:
+ return False
+
+ def test_python3_installed(self, python3_cli):
+ if not python3_cli:
+ pytest.fail("Error: python3 not installed")
+ else:
+ pass
+
+
+@pytest.mark.skipif(TestPython3Installed.python3_cli, reason="no python3 installed")
class TestNewPython34Modules:
skip_python3 = python3_cli()
- @pytest.mark.skipIf("TestNewPython34Modules.skip_python3")
def test_python34_asyncio(self):
python34_module("asyncio")
- @pytest.mark.skipIf("TestNewPython34Modules.skip_python3")
def test_python34_ensurepip(self):
python34_module("ensurepip")
- @pytest.mark.skipIf("TestPython3Installed.skip_python3")
def test_python34_enum(self):
python34_module("enum")
- @pytest.mark.skipIf("TestPython3Installed.skip_python3")
def test_python34_pathlib(self):
python34_module("pathlib")
- @pytest.mark.skipIf("TestPython3Installed.skip_python3")
def test_python34_selectors(self):
python34_module("selectors")
- @pytest.mark.skipIf("TestPython3Installed.skip_python3")
def test_python34_statistics(self):
python34_module("statistics")
- @pytest.mark.skipIf("TestPython3Installed.skip_python3")
def test_python34_tracemalloc(self):
python34_module("tracemalloc")