diff options
| author | Adam Hupp <adam@hupp.org> | 2022-04-25 15:21:35 -0700 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2022-05-22 05:54:13 -0700 |
| commit | 51e34d2b8b84f1a582b4dbbfa3693957ddc3f48a (patch) | |
| tree | c15a36933be11d1b82685b0e787e55f95168770e /test | |
| parent | 585373b5d952e579a9f7bd8f6418ca0bfd6a5e35 (diff) | |
| download | python-magic-51e34d2b8b84f1a582b4dbbfa3693957ddc3f48a.tar.gz | |
use tox for all the multi-version testing
Diffstat (limited to 'test')
| -rwxr-xr-x | test/docker/alpine | 7 | ||||
| -rwxr-xr-x | test/docker/bionic | 11 | ||||
| -rw-r--r-- | test/docker/centos7 | 8 | ||||
| -rw-r--r-- | test/docker/centos8 | 8 | ||||
| -rwxr-xr-x | test/docker/focal | 11 | ||||
| -rwxr-xr-x | test/docker/xenial | 11 | ||||
| -rw-r--r-- | test/run_all_versions.py | 35 |
7 files changed, 34 insertions, 57 deletions
diff --git a/test/docker/alpine b/test/docker/alpine index eb511d7..c36b720 100755 --- a/test/docker/alpine +++ b/test/docker/alpine @@ -1,4 +1,7 @@ FROM python:3.8-alpine3.12 RUN apk add python3 python2 libmagic -COPY . /python-magic -CMD cd /python-magic/test && python3 ./run.py +WORKDIR /python-magic +COPY . . +RUN python3 -m pip install tox +CMD python3 -m tox + diff --git a/test/docker/bionic b/test/docker/bionic index e335b8e..2fe482c 100755 --- a/test/docker/bionic +++ b/test/docker/bionic @@ -1,8 +1,9 @@ FROM ubuntu:bionic +WORKDIR /python-magic +COPY . . RUN apt-get update -RUN apt-get -y install python -RUN apt-get -y install python3 -RUN apt-get -y install locales +RUN apt-get -y install python python3 locales python3-pip libmagic1 RUN locale-gen en_US.UTF-8 -COPY . /python-magic -CMD cd /python-magic/test && python3 ./run.py +RUN python3 -m pip install tox +CMD python3 -m tox + diff --git a/test/docker/centos7 b/test/docker/centos7 index f2ac6e4..10f170a 100644 --- a/test/docker/centos7 +++ b/test/docker/centos7 @@ -1,5 +1,9 @@ FROM centos:7 RUN yum -y update RUN yum -y install file-devel python3 python2 which -COPY . /python-magic -CMD cd /python-magic/test && SKIP_FROM_DESCRIPTOR=1 python3 ./run.py +WORKDIR /python-magic +COPY . . +RUN python3 -m pip install tox +ENV SKIP_FROM_DESCRIPTOR=1 +CMD python3 -m tox + diff --git a/test/docker/centos8 b/test/docker/centos8 index 968f6b6..3b3da0a 100644 --- a/test/docker/centos8 +++ b/test/docker/centos8 @@ -4,6 +4,8 @@ RUN yum -y install file-libs python3 python2 which glibc-locale-source RUN yum reinstall glibc-common -y && \ localedef -i en_US -f UTF-8 en_US.UTF-8 && \ echo "LANG=en_US.UTF-8" > /etc/locale.conf -ENV LANG en_US.UTF-8 -COPY . /python-magic -CMD cd /python-magic/test && python3 ./run.py +WORKDIR /python-magic +COPY . . +RUN python3 -m pip install tox +CMD python3 -m tox + diff --git a/test/docker/focal b/test/docker/focal index 74e4d78..b35040b 100755 --- a/test/docker/focal +++ b/test/docker/focal @@ -1,8 +1,9 @@ FROM ubuntu:focal +WORKDIR /python-magic +COPY . . RUN apt-get update -RUN apt-get -y install python2 -RUN apt-get -y install python3 -RUN apt-get -y install locales +RUN apt-get -y install python python3 locales python3-pip libmagic1 RUN locale-gen en_US.UTF-8 -COPY . /python-magic -CMD cd /python-magic/test && python3 ./run.py +RUN python3 -m pip install tox +CMD python3 -m tox + diff --git a/test/docker/xenial b/test/docker/xenial index bc0440b..e3c0433 100755 --- a/test/docker/xenial +++ b/test/docker/xenial @@ -1,8 +1,9 @@ FROM ubuntu:xenial +WORKDIR /python-magic +COPY . . RUN apt-get update -RUN apt-get -y install python -RUN apt-get -y install python3 -RUN apt-get -y install locales +RUN apt-get -y install python python3 locales python3-pip libmagic1 RUN locale-gen en_US.UTF-8 -COPY . /python-magic -CMD cd /python-magic/test && python3 ./run.py +RUN python3 -m pip install tox +CMD python3 -m tox + diff --git a/test/run_all_versions.py b/test/run_all_versions.py deleted file mode 100644 index d9e7ec5..0000000 --- a/test/run_all_versions.py +++ /dev/null @@ -1,35 +0,0 @@ -import subprocess -import os.path -import sys - -this_dir = os.path.dirname(sys.argv[0]) - -new_env = dict(os.environ) -new_env.update({ - 'LC_ALL': 'en_US.UTF-8', - 'PYTHONPATH': os.path.join(this_dir, ".."), -}) - - -def has_py(version): - ret = subprocess.run("which %s" % version, shell=True, stdout=subprocess.DEVNULL) - return ret.returncode == 0 - - -def run_test(versions): - found = False - for i in versions: - if not has_py(i): - # if this version doesn't exist in path, skip - continue - found = True - print("Testing %s" % i) - subprocess.run([i, os.path.join(this_dir, "python_magic_test.py")], env=new_env, check=True) - subprocess.run([i, os.path.join(this_dir, "libmagic_test.py")], env=new_env, check=True) - - if not found: - sys.exit("No versions found: " + str(versions)) - -run_test(["python2", "python2.7"]) -run_test(["python3.5", "python3.6", "python3.7", "python3.8", "python3.9"]) - |
