I worked on testing Breezy on Python 3.8. I had issues to find how to run tests. And I failed to reproduce the bug. After many trial-and-error attempts, I found the following commands to run the test suite. Result: "FAILED (failures=6, errors=7, known_failure_count=66)". I had to fix 2 syntax errors and replace isAlive() with is_alive(). FYI is_alive() works since Python 2.6, so it's compatible with Python 2.7. My patch: ================================================================ diff --git a/breezy/bzr/smart/server.py b/breezy/bzr/smart/server.py index 837c103..ef23166 100644 --- a/breezy/bzr/smart/server.py +++ b/breezy/bzr/smart/server.py @@ -267,7 +267,7 @@ class SmartTCPServer(object): still_active = [] for handler, thread in self._active_connections: thread.join(timeout) - if thread.isAlive(): + if thread.is_alive(): still_active.append((handler, thread)) self._active_connections = still_active diff --git a/breezy/info.py b/breezy/info.py index 08e3e96..24fd81a 100644 --- a/breezy/info.py +++ b/breezy/info.py @@ -113,7 +113,7 @@ def gather_location_info(repository=None, branch=None, working=None, if working_path == master_path_base: locs['checkout of co-located branch'] = params['branch'] elif 'branch' in params: - locs['checkout of branch'] = "%s, branch %s" ( + locs['checkout of branch'] = "%s, branch %s" % ( master_path_base, params['branch']) else: locs['checkout of branch'] = master_path diff --git a/breezy/patch.py b/breezy/patch.py index eee4fe2..446a570 100644 --- a/breezy/patch.py +++ b/breezy/patch.py @@ -47,7 +47,7 @@ def write_to_cmd(args, input=""): stdout, stderr = process.communicate(input) status = process.wait() if status < 0: - raise Exception("%s killed by signal %i" (args[0], -status)) + raise Exception("%s killed by signal %i" % (args[0], -status)) return stdout, stderr, status diff --git a/breezy/tests/test_server.py b/breezy/tests/test_server.py index 81c2c0f..3a357b0 100644 --- a/breezy/tests/test_server.py +++ b/breezy/tests/test_server.py @@ -256,7 +256,7 @@ class TestThread(cethread.CatchingExceptionThread): serving a client connection is hung. """ super(TestThread, self).join(timeout) - if timeout and self.isAlive(): + if timeout and self.is_alive(): # The timeout expired without joining the thread, the thread is # therefore stucked and that's a failure as far as the test is # concerned. We used to hang here. ================================================================ Commands: ================================= tar -xf breezy-3.0.1.tar.gz cd breezy-3.0.1/ git apply ~/breezy-python38.patch find . -name '*_pyx.c' -exec rm \{\} \; python3.8 -m venv env # the secret dependency :-) env/bin/python -m pip install python-subunit source env/bin/activate # following commands are run in the venv python setup.py install $PWD/env/bin/brz selftest --parallel=fork ================================= Extract of the tests output below. ERROR: blackbox.test_locale.TestLocale.test_log_CMerge.test_lca_merge_criss_cross FAIL: test_export_pot.TestParseSource.test_strings_multilineiledLtPathByDirblock.test_tricky_paths FAIL: test_import_tariff.TestImportTariffs.test_simple_localilderBuildSnapshot.test_add_second_file AssertionError: command loaded forbidden modules ['shutil', 'socket', 'tempfile'] AssertionError: command loaded forbidden modules ['tempfile'] ERROR: test_xml.TestSerializer.test_revision_text_v7.test_empty_property_value File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1295, in _ndiff_strings if b and not b.endswith('\n'): TypeError: endswith first arg must be bytes or a tuple of bytes, not str FAIL: test_source.TestSource.test_gplp.TestCommandHelp.test_command_only_additional_see_also Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_source.py", line 269, in test_gpl self.fail('\n'.join(help_text)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/unittest2/case.py", line 690, in fail raise self.failureException(msg) AssertionError: Some files have missing or incomplete GPL statement ERROR: test_xml.TestSerializer.test_revision_text_v8_smart_wsgi_app_uses_given_relpath Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_xml.py", line 468, in test_revision_text_v8 self.assertEqualDiff(serialized, _expected_rev_v8) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1339, in assertEqualDiff + self._ndiff_strings(a, b)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1295, in _ndiff_strings if b and not b.endswith('\n'): TypeError: endswith first arg must be bytes or a tuple of bytes, not str ERROR: test_xml.TestSerializer.test_pack_revision_5.test_jail_root Empty attachments: log Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_xml.py", line 349, in test_pack_revision_5 self.assertEqualDiff(outfile_contents, _expected_rev_v5) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1339, in assertEqualDiff + self._ndiff_strings(a, b)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1295, in _ndiff_strings if b and not b.endswith('\n'): TypeError: endswith first arg must be bytes or a tuple of bytes, not str ERROR: unittest.loader._FailedTest.breezy.plugins.launchpadtest_output_redirection Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/plugins/launchpad/lp_api.py", line 59, in import launchpadlib ModuleNotFoundError: No module named 'launchpadlib' The test suite emits tons of warnings, some can be real bugs. Examples: /usr/lib64/python3.8/os.py:1020: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used return io.open(fd, *args, **kwargs) /home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/fastimport-0.9.8-py3.8.egg/fastimport/parser.py:16: DeprecationWarning: invalid escape sequence \c /home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/git/remote.py:171: DeprecationWarning: urllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() instead ERROR: breezy.tests.blackbox.test_locale.TestLocale.test_log_BOGUS b'brz: warning: unsupported locale setting\n bzr could not set the application locale.\n Although this should be no problem for bzr itself, it might\n cause problems with some plugins. To investigate the issue,\n look at the output of the locale(1p) tool.\nTraceback (most recent call last):\n File "/home/vstinner/breezy-3.0.1/env/bin/brz", line 4, in \n __import__(\'pkg_resources\').run_script(\'breezy==3.0.1\', \'brz\')\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 666, in run_script\n self.require(requires)[0].run_script(script_name, ns)\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 1446, in run_script\n exec(code, namespace, namespace)\n File "/home/vstinner/breezy-3.0.1/env/lib/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/EGG-INFO/scripts/brz", line 63, in \n import breezy\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/__init__.py", line 161, in \n _fs_enc = _patch_filesystem_default_encoding(sys._brz_default_fs_enc)\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/__init__.py", line 151, in _patch_filesystem_default_encoding\n raise RuntimeError("Failed to change the filesystem default encoding")\nRuntimeError: Failed to change the filesystem default encoding\n' ERROR: breezy.tests.blackbox.test_locale.TestLocale.test_log_C b'Traceback (most recent call last):\n File "/home/vstinner/breezy-3.0.1/env/bin/brz", line 4, in \n __import__(\'pkg_resources\').run_script(\'breezy==3.0.1\', \'brz\')\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 666, in run_script\n self.require(requires)[0].run_script(script_name, ns)\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 1446, in run_script\n exec(code, namespace, namespace)\n File "/home/vstinner/breezy-3.0.1/env/lib/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/EGG-INFO/scripts/brz", line 63, in \n import breezy\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/__init__.py", line 161, in \n _fs_enc = _patch_filesystem_default_encoding(sys._brz_default_fs_enc)\n File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/__init__.py", line 151, in _patch_filesystem_default_encoding\n raise RuntimeError("Failed to change the filesystem default encoding")\nRuntimeError: Failed to change the filesystem default encoding\n' ERROR: breezy.tests.test_xml.TestSerializer.test_revision_text_v7 File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_xml.py", line 460, in test_revision_text_v7 self.assertEqualDiff(serialized, _expected_rev_v5) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1339, in assertEqualDiff + self._ndiff_strings(a, b)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1295, in _ndiff_strings if b and not b.endswith('\n'): TypeError: endswith first arg must be bytes or a tuple of bytes, not str ====================================================================== ERROR: unittest.loader._FailedTest.breezy.plugins.launchpad ---------------------------------------------------------------------- Traceback (most recent call last): testtools.testresult.real._StringException: Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/plugins/launchpad/lp_api.py", line 59, in import launchpadlib ModuleNotFoundError: No module named 'launchpadlib' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/plugins/launchpad/__init__.py", line 100, in load_tests basic_tests.addTest(loader.loadTestsFromModuleNames( File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/TestUtil.py", line 147, in loadTestsFromModuleNames result.addTests(self.loadTestsFromModuleName(name)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/TestUtil.py", line 152, in loadTestsFromModuleName module = pyutils.get_named_object(name) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/pyutils.py", line 58, in get_named_object __import__(module_name, globals(), locals(), []) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/plugins/launchpad/test_register.py", line 34, in from .lp_registration import ( File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/plugins/launchpad/lp_registration.py", line 51, in from .lp_api import ( File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/plugins/launchpad/lp_api.py", line 61, in raise LaunchpadlibMissing(e) breezy.plugins.launchpad.lp_api.LaunchpadlibMissing: launchpadlib is required for Launchpad API access. Please install the launchpadlib package. ====================================================================== ERROR: breezy.tests.test_xml.TestSerializer.test_revision_text_v6 ---------------------------------------------------------------------- Traceback (most recent call last): testtools.testresult.real._StringException: Empty attachments: log Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_xml.py", line 452, in test_revision_text_v6 self.assertEqualDiff(serialized, _expected_rev_v5) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1339, in assertEqualDiff + self._ndiff_strings(a, b)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1295, in _ndiff_strings if b and not b.endswith('\n'): TypeError: endswith first arg must be bytes or a tuple of bytes, not str ====================================================================== FAIL: breezy.tests.test_export_pot.TestParseSource.test_strings_multiline ---------------------------------------------------------------------- Traceback (most recent call last): testtools.testresult.real._StringException: Empty attachments: log Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_export_pot.py", line 138, in test_strings_multiline self.assertEqual(str_lines, File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/__init__.py", line 1315, in assertEqual raise AssertionError("%snot equal:\na = %s\nb = %s\n" AssertionError: not equal: a = {'ABC': 6, 'Start\n\nEnd\n': -2} b = {'ABC': 6, 'Start\n\nEnd\n': 1} ====================================================================== FAIL: breezy.tests.test_import_tariff.TestImportTariffs.test_simple_local ---------------------------------------------------------------------- (...) AssertionError: command loaded forbidden modules ['shutil', 'socket', 'tempfile'] ====================================================================== FAIL: breezy.tests.test_import_tariff.TestImportTariffs.test_simple_serve ---------------------------------------------------------------------- AssertionError: command loaded forbidden modules ['tempfile'] ====================================================================== FAIL: breezy.tests.test_source.TestSource.test_gpl ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_source.py", line 269, in test_gpl self.fail('\n'.join(help_text)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/unittest2/case.py", line 690, in fail raise self.failureException(msg) AssertionError: Some files have missing or incomplete GPL statement ====================================================================== FAIL: breezy.tests.test_source.TestSource.test_copyright ---------------------------------------------------------------------- Traceback (most recent call last): testtools.testresult.real._StringException: Empty attachments: log Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_source.py", line 228, in test_copyright self.fail('\n'.join(help_text)) File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/unittest2/case.py", line 690, in fail raise self.failureException(msg) AssertionError: Some files have missing or incorrect copyright statements. /home/vstinner/breezy-3.0.1/env/bin/brz no copyright line found /home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/_patiencediff_c.py no copyright line found /home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/_static_tuple_c.py no copyright line found ====================================================================== FAIL: breezy.tests.test_source.TestSource.test_feature_absolute_import ---------------------------------------------------------------------- Traceback (most recent call last): testtools.testresult.real._StringException: Empty attachments: log Traceback (most recent call last): File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/tests/test_source.py", line 464, in test_feature_absolute_import self.fail( File "/home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/unittest2/case.py", line 690, in fail raise self.failureException(msg) AssertionError: The following files do not have absolute_import enabled: /home/vstinner/breezy-3.0.1/env/bin/brz /home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/_patiencediff_c.py /home/vstinner/breezy-3.0.1/env/lib64/python3.8/site-packages/breezy-3.0.1-py3.8-linux-x86_64.egg/breezy/_static_tuple_c.py FAILED (failures=6, errors=7, known_failure_count=66)