summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2021-06-01 11:52:42 -0700
committerAdam Hupp <adam@hupp.org>2021-06-01 12:24:49 -0700
commitae483dc845ec6edd35861f5c46e70cd4d229e4f2 (patch)
tree8255ff870f30ddce7979a62e4e0d6cc9ad32914a
parent816e4d704d455eaf5c1e06e1af1b75fdb8ef2f5a (diff)
downloadpython-magic-ae483dc845ec6edd35861f5c46e70cd4d229e4f2.tar.gz
Update tests and docker config for newer versions
-rwxr-xr-xtest/Dockerfile_archlinux2
-rw-r--r--test/Dockerfile_centos86
-rw-r--r--test/libmagic_test.py4
-rwxr-xr-xtest/test.py3
4 files changed, 10 insertions, 5 deletions
diff --git a/test/Dockerfile_archlinux b/test/Dockerfile_archlinux
index 677add4..fc96c44 100755
--- a/test/Dockerfile_archlinux
+++ b/test/Dockerfile_archlinux
@@ -1,4 +1,4 @@
-FROM archlinux:20200505
+FROM archlinux:latest
RUN yes | pacman -Syyu --overwrite '*'
RUN yes | pacman -S python python2 file which
COPY . /python-magic
diff --git a/test/Dockerfile_centos8 b/test/Dockerfile_centos8
index 505221b..968f6b6 100644
--- a/test/Dockerfile_centos8
+++ b/test/Dockerfile_centos8
@@ -1,5 +1,9 @@
FROM centos:8
RUN yum -y update
-RUN yum -y install file-libs python3 python2 which
+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
diff --git a/test/libmagic_test.py b/test/libmagic_test.py
index 64b7ec4..88f1254 100644
--- a/test/libmagic_test.py
+++ b/test/libmagic_test.py
@@ -11,12 +11,12 @@ class MagicTestCase(unittest.TestCase):
filename = 'testdata/test.pdf'
expected_mime_type = 'application/pdf'
expected_encoding = 'us-ascii'
- expected_name = 'PDF document, version 1.2'
+ expected_name = ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages')
def assert_result(self, result):
self.assertEqual(result.mime_type, self.expected_mime_type)
self.assertEqual(result.encoding, self.expected_encoding)
- self.assertEqual(result.name, self.expected_name)
+ self.assertIn(result.name, self.expected_name)
def test_detect_from_filename(self):
result = magic.detect_from_filename(self.filename)
diff --git a/test/test.py b/test/test.py
index 949c77e..0cd12fd 100755
--- a/test/test.py
+++ b/test/test.py
@@ -107,7 +107,8 @@ class MagicTest(unittest.TestCase):
try:
self.assert_values(m, {
'magic._pyc_': 'python 2.4 byte-compiled',
- 'test.pdf': 'PDF document, version 1.2',
+ 'test.pdf': ('PDF document, version 1.2',
+ 'PDF document, version 1.2, 2 pages'),
'test.gz':
('gzip compressed data, was "test", from Unix, last '
'modified: Sun Jun 29 01:32:52 2008',