From a4eb1127303fbe514ab8f77d6c3896614de02c5d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 1 Jul 2020 20:49:30 -0400 Subject: Fix failing test in test_fileutil by adapting expectation based on Python version. --- distutils/tests/py35compat.py | 9 +++++++++ distutils/tests/test_filelist.py | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/distutils/tests/py35compat.py b/distutils/tests/py35compat.py index 3eb86b5f..0c755261 100644 --- a/distutils/tests/py35compat.py +++ b/distutils/tests/py35compat.py @@ -66,3 +66,12 @@ vars(subprocess).setdefault( '_optim_args_from_interpreter_flags', _optim_args_from_interpreter_flags, ) + + +def adapt_glob(regex): + """ + Supply legacy expectation on Python 3.5 + """ + if sys.version_info > (3, 6): + return regex + return regex.replace('(?s:', '').replace(r')\Z', r'\Z(?ms)') diff --git a/distutils/tests/test_filelist.py b/distutils/tests/test_filelist.py index c71342d0..71fde2b7 100644 --- a/distutils/tests/test_filelist.py +++ b/distutils/tests/test_filelist.py @@ -12,6 +12,9 @@ import test.support from test.support import captured_stdout, run_unittest from distutils.tests import support +from .py35compat import adapt_glob + + MANIFEST_IN = """\ include ok include xo @@ -60,7 +63,7 @@ class FileListTestCase(support.LoggingSilencer, ('foo????', r'(?s:foo[^%(sep)s][^%(sep)s][^%(sep)s][^%(sep)s])\Z'), (r'foo\\??', r'(?s:foo\\\\[^%(sep)s][^%(sep)s])\Z')): regex = regex % {'sep': sep} - self.assertEqual(glob_to_re(glob), regex) + self.assertEqual(glob_to_re(glob), adapt_glob(regex)) def test_process_template_line(self): # testing all MANIFEST.in template patterns -- cgit v1.2.3