diff options
author | Tim Orling <timothy.t.orling@linux.intel.com> | 2016-10-05 22:31:15 -0700 |
---|---|---|
committer | Tim Orling <timothy.t.orling@linux.intel.com> | 2016-10-05 22:31:15 -0700 |
commit | 7589c42e2e18720d3acae57f9ea05d4fe30b30ac (patch) | |
tree | dc9f65d38b268f7063eba562915726fa030bb9e2 | |
parent | e46925aadc96e5ddf77519da3445deede8c47bb7 (diff) | |
download | epel6-testing-container-7589c42e2e18720d3acae57f9ea05d4fe30b30ac.tar.gz epel6-testing-container-7589c42e2e18720d3acae57f9ea05d4fe30b30ac.tar.xz epel6-testing-container-7589c42e2e18720d3acae57f9ea05d4fe30b30ac.zip |
add python3 and python34 tests; add build_and_run.sh
Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
-rw-r--r-- | Dockerfile | 5 | ||||
-rwxr-xr-x | build_and_run.sh | 18 | ||||
-rw-r--r-- | tests/test_python34.py | 38 |
3 files changed, 49 insertions, 12 deletions
@@ -17,8 +17,9 @@ FROM centos:6.8 RUN yum -y update; yum clean all RUN yum -y install epel-release; yum clean all -RUN yum -y install rpm python python-pip epel-rpm-macros python-rpm-macros python34; yum clean all -RUN yum -y update --enablerepo=epel-testing +RUN yum -y install rpm python python-pip epel-rpm-macros python-rpm-macros; yum clean all +RUN yum -y update --enablerepo=epel-testing; yum clean all +RUN yum -y install python34 --enablerepo=epel-testing; yum clean all RUN pip install -U pytest COPY tests/* tests/ diff --git a/build_and_run.sh b/build_and_run.sh new file mode 100755 index 0000000..903fe37 --- /dev/null +++ b/build_and_run.sh @@ -0,0 +1,18 @@ +# !/bin/sh +# Copyright (C) 2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +docker build -t epel6-testing . +docker run --rm -t epel6-testing diff --git a/tests/test_python34.py b/tests/test_python34.py index ce92c7b..2fd3179 100644 --- a/tests/test_python34.py +++ b/tests/test_python34.py @@ -16,33 +16,51 @@ import os import pytest import shlex +import sys from subprocess import Popen, PIPE +def python3_cli(): + try: + Popen("python3").communicate()[0] + return True + except OSError: + pytest.fail("OSError: python3 not installed") + return False + def python34_module(modulename): - cmd = shlex.split("python3 -m {}" % modulename) - output = Popen(cmd, stdout=PIPE).communicate()[0] - return output - + cmd = shlex.split("python3 -m %s" % modulename) + try: + Popen(cmd, stdout=PIPE).communicate()[0] + except: + pytest.fail("Error: python module %s not present" % modulename) class TestNewPython34Modules: + skip_python3 = python3_cli() + @pytest.mark.skipIf("TestNewPython34Modules.skip_python3") def test_python34_asyncio(self): python34_module("asyncio") - def test_python34_ensurepip(self, python34_module("ensurepip")): + @pytest.mark.skipIf("TestNewPython34Modules.skip_python3") + def test_python34_ensurepip(self): python34_module("ensurepip") - def test_python34_enum(self, python34_module("enum")): + @pytest.mark.skipIf("TestPython3Installed.skip_python3") + def test_python34_enum(self): python34_module("enum") - def test_python34_pathlib(self, python34_module("pathlib")): + @pytest.mark.skipIf("TestPython3Installed.skip_python3") + def test_python34_pathlib(self): python34_module("pathlib") - def test_python34_selectors(self, python34_module("selectors")): + @pytest.mark.skipIf("TestPython3Installed.skip_python3") + def test_python34_selectors(self): python34_module("selectors") - def test_python34_statistics(self, python34_module("statistics")): + @pytest.mark.skipIf("TestPython3Installed.skip_python3") + def test_python34_statistics(self): python34_module("statistics") - def test_python34_tracemalloc(self, python34_module("tracemalloc")): + @pytest.mark.skipIf("TestPython3Installed.skip_python3") + def test_python34_tracemalloc(self): python34_module("tracemalloc") |