summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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")