From ae483dc845ec6edd35861f5c46e70cd4d229e4f2 Mon Sep 17 00:00:00 2001 From: Adam Hupp Date: Tue, 1 Jun 2021 11:52:42 -0700 Subject: Update tests and docker config for newer versions --- test/Dockerfile_archlinux | 2 +- test/Dockerfile_centos8 | 6 +++++- test/libmagic_test.py | 4 ++-- test/test.py | 3 ++- 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', -- cgit v1.2.1