Commit 8a59142d authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.29.x'

parents 808fd684 27b67092
...@@ -941,7 +941,7 @@ Other changes ...@@ -941,7 +941,7 @@ Other changes
.. _0.29.28: .. _0.29.28:
0.29.28 (2022-02-16) 0.29.28 (2022-02-17)
==================== ====================
Bugs fixed Bugs fixed
......
...@@ -696,6 +696,7 @@ class TestBuilder(object): ...@@ -696,6 +696,7 @@ class TestBuilder(object):
self.workdir = workdir self.workdir = workdir
self.selectors = selectors self.selectors = selectors
self.exclude_selectors = exclude_selectors self.exclude_selectors = exclude_selectors
self.shard_num = options.shard_num
self.annotate = options.annotate_source self.annotate = options.annotate_source
self.cleanup_workdir = options.cleanup_workdir self.cleanup_workdir = options.cleanup_workdir
self.cleanup_sharedlibs = options.cleanup_sharedlibs self.cleanup_sharedlibs = options.cleanup_sharedlibs
...@@ -781,7 +782,7 @@ class TestBuilder(object): ...@@ -781,7 +782,7 @@ class TestBuilder(object):
if 'cpp' not in tags['tag'] or 'cpp' in self.languages: if 'cpp' not in tags['tag'] or 'cpp' in self.languages:
suite.addTest(EndToEndTest(filepath, workdir, suite.addTest(EndToEndTest(filepath, workdir,
self.cleanup_workdir, stats=self.stats, self.cleanup_workdir, stats=self.stats,
capture=self.capture)) capture=self.capture, shard_num=self.shard_num))
continue continue
# Choose the test suite. # Choose the test suite.
...@@ -811,7 +812,8 @@ class TestBuilder(object): ...@@ -811,7 +812,8 @@ class TestBuilder(object):
if pyver if pyver
] ]
if not min_py_ver or any(sys.version_info >= min_ver for min_ver in min_py_ver): if not min_py_ver or any(sys.version_info >= min_ver for min_ver in min_py_ver):
suite.addTest(PureDoctestTestCase(module, filepath, tags, stats=self.stats)) suite.addTest(PureDoctestTestCase(
module, filepath, tags, stats=self.stats, shard_num=self.shard_num))
return suite return suite
...@@ -892,6 +894,7 @@ class TestBuilder(object): ...@@ -892,6 +894,7 @@ class TestBuilder(object):
cleanup_failures=self.cleanup_failures, cleanup_failures=self.cleanup_failures,
cython_only=self.cython_only, cython_only=self.cython_only,
test_selector=self.test_selector, test_selector=self.test_selector,
shard_num=self.shard_num,
fork=self.fork, fork=self.fork,
language_level=language_level or self.language_level, language_level=language_level or self.language_level,
warning_errors=warning_errors, warning_errors=warning_errors,
...@@ -947,7 +950,7 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -947,7 +950,7 @@ class CythonCompileTestCase(unittest.TestCase):
expect_errors=False, expect_warnings=False, annotate=False, cleanup_workdir=True, expect_errors=False, expect_warnings=False, annotate=False, cleanup_workdir=True,
cleanup_sharedlibs=True, cleanup_failures=True, cython_only=False, test_selector=None, cleanup_sharedlibs=True, cleanup_failures=True, cython_only=False, test_selector=None,
fork=True, language_level=2, warning_errors=False, fork=True, language_level=2, warning_errors=False,
test_determinism=False, test_determinism=False, shard_num=0,
common_utility_dir=None, pythran_dir=None, stats=None, add_cython_import=False, common_utility_dir=None, pythran_dir=None, stats=None, add_cython_import=False,
extra_directives=None): extra_directives=None):
if extra_directives is None: if extra_directives is None:
...@@ -968,6 +971,7 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -968,6 +971,7 @@ class CythonCompileTestCase(unittest.TestCase):
self.cleanup_failures = cleanup_failures self.cleanup_failures = cleanup_failures
self.cython_only = cython_only self.cython_only = cython_only
self.test_selector = test_selector self.test_selector = test_selector
self.shard_num = shard_num
self.fork = fork self.fork = fork
self.language_level = language_level self.language_level = language_level
self.warning_errors = warning_errors self.warning_errors = warning_errors
...@@ -980,7 +984,8 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -980,7 +984,8 @@ class CythonCompileTestCase(unittest.TestCase):
unittest.TestCase.__init__(self) unittest.TestCase.__init__(self)
def shortDescription(self): def shortDescription(self):
return "compiling (%s%s%s) %s" % ( return "[%d] compiling (%s%s%s) %s" % (
self.shard_num,
self.language, self.language,
"/cy2" if self.language_level == 2 else "/cy3" if self.language_level == 3 else "", "/cy2" if self.language_level == 2 else "/cy3" if self.language_level == 3 else "",
"/pythran" if self.pythran_dir is not None else "", "/pythran" if self.pythran_dir is not None else "",
...@@ -1569,15 +1574,17 @@ def run_forked_test(result, run_func, test_name, fork=True): ...@@ -1569,15 +1574,17 @@ def run_forked_test(result, run_func, test_name, fork=True):
class PureDoctestTestCase(unittest.TestCase): class PureDoctestTestCase(unittest.TestCase):
def __init__(self, module_name, module_path, tags, stats=None): def __init__(self, module_name, module_path, tags, stats=None, shard_num=0):
self.tags = tags self.tags = tags
self.module_name = self.name = module_name self.module_name = self.name = module_name
self.module_path = module_path self.module_path = module_path
self.stats = stats self.stats = stats
self.shard_num = shard_num
unittest.TestCase.__init__(self, 'run') unittest.TestCase.__init__(self, 'run')
def shortDescription(self): def shortDescription(self):
return "running pure doctests in %s" % self.module_name return "[%d] running pure doctests in %s" % (
self.shard_num, self.module_name)
def run(self, result=None): def run(self, result=None):
if result is None: if result is None:
...@@ -1679,7 +1686,8 @@ class PartialTestResult(TextTestResult): ...@@ -1679,7 +1686,8 @@ class PartialTestResult(TextTestResult):
class CythonUnitTestCase(CythonRunTestCase): class CythonUnitTestCase(CythonRunTestCase):
def shortDescription(self): def shortDescription(self):
return "compiling (%s) tests in %s" % (self.language, self.description_name()) return "[%d] compiling (%s) tests in %s" % (
self.shard_num, self.language, self.description_name())
def run_tests(self, result, ext_so_path): def run_tests(self, result, ext_so_path):
with self.stats.time(self.name, self.language, 'import'): with self.stats.time(self.name, self.language, 'import'):
...@@ -1879,13 +1887,14 @@ class EndToEndTest(unittest.TestCase): ...@@ -1879,13 +1887,14 @@ class EndToEndTest(unittest.TestCase):
""" """
cython_root = os.path.dirname(os.path.abspath(__file__)) cython_root = os.path.dirname(os.path.abspath(__file__))
def __init__(self, treefile, workdir, cleanup_workdir=True, stats=None, capture=True): def __init__(self, treefile, workdir, cleanup_workdir=True, stats=None, capture=True, shard_num=0):
self.name = os.path.splitext(os.path.basename(treefile))[0] self.name = os.path.splitext(os.path.basename(treefile))[0]
self.treefile = treefile self.treefile = treefile
self.workdir = os.path.join(workdir, self.name) self.workdir = os.path.join(workdir, self.name)
self.cleanup_workdir = cleanup_workdir self.cleanup_workdir = cleanup_workdir
self.stats = stats self.stats = stats
self.capture = capture self.capture = capture
self.shard_num = shard_num
cython_syspath = [self.cython_root] cython_syspath = [self.cython_root]
for path in sys.path: for path in sys.path:
if path.startswith(self.cython_root) and path not in cython_syspath: if path.startswith(self.cython_root) and path not in cython_syspath:
...@@ -1897,7 +1906,8 @@ class EndToEndTest(unittest.TestCase): ...@@ -1897,7 +1906,8 @@ class EndToEndTest(unittest.TestCase):
unittest.TestCase.__init__(self) unittest.TestCase.__init__(self)
def shortDescription(self): def shortDescription(self):
return "End-to-end %s" % self.name return "[%d] End-to-end %s" % (
self.shard_num, self.name)
def setUp(self): def setUp(self):
from Cython.TestUtils import unpack_source_tree from Cython.TestUtils import unpack_source_tree
...@@ -1954,8 +1964,8 @@ class EndToEndTest(unittest.TestCase): ...@@ -1954,8 +1964,8 @@ class EndToEndTest(unittest.TestCase):
res = -1 res = -1
if res != 0: if res != 0:
for c, o, e in zip(cmd, out, err): for c, o, e in zip(cmd, out, err):
sys.stderr.write("%s\n%s\n%s\n\n" % ( sys.stderr.write("[%d] %s\n%s\n%s\n\n" % (
c, self._try_decode(o), self._try_decode(e))) self.shard_num, c, self._try_decode(o), self._try_decode(e)))
self.assertEqual(0, res, "non-zero exit status, last output was:\n%r\n-- stdout:%s\n-- stderr:%s\n" % ( self.assertEqual(0, res, "non-zero exit status, last output was:\n%r\n-- stdout:%s\n-- stderr:%s\n" % (
' '.join(command), self._try_decode(out[-1]), self._try_decode(err[-1]))) ' '.join(command), self._try_decode(out[-1]), self._try_decode(err[-1])))
self.success = True self.success = True
......
...@@ -8,13 +8,13 @@ PYTHON package_test.py ...@@ -8,13 +8,13 @@ PYTHON package_test.py
import os.path import os.path
with open("pkg/test.c.dep", "r") as f: with open("pkg/test.c.dep", "r") as f:
contents = f.read().replace("\\\n", " ").replace("\\\n", " ") contents = f.read().replace("\\\n", " ").replace("\n", " ")
assert sorted(contents.split()) == sorted(['test.c:', os.path.join('sub', 'incl.pxi'), 'test.pxd', 'test.pyx']), contents assert sorted(contents.split()) == sorted(['test.c:', os.path.join('sub', 'incl.pxi'), 'test.pxd', 'test.pyx']), contents
with open("pkg/sub/test.c.dep", "r") as f: with open("pkg/sub/test.c.dep", "r") as f:
contents = f.read().replace("\n", " ").replace("\\", "") contents = f.read().replace("\\\n", " ").replace("\n", " ")
contents = [os.path.relpath(entry, '.') contents = [os.path.relpath(entry, '.')
if os.path.isabs(entry) else entry for entry in contents.split()] if os.path.isabs(entry) else entry for entry in contents.split()]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment