From 930329126d4d041ab4166139afe5fee01c04fa4e Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Fri, 7 May 2021 13:28:01 -0400 Subject: [PATCH] One final test module to port to Python 3 (nominally). --- src/allmydata/test/test_python2_regressions.py | 12 ++++++++++++ src/allmydata/util/_python3.py | 1 + 2 files changed, 13 insertions(+) diff --git a/src/allmydata/test/test_python2_regressions.py b/src/allmydata/test/test_python2_regressions.py index 59b16d011..c641d2dba 100644 --- a/src/allmydata/test/test_python2_regressions.py +++ b/src/allmydata/test/test_python2_regressions.py @@ -2,6 +2,16 @@ Tests to check for Python2 regressions """ +from __future__ import unicode_literals +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from future.utils import PY2 +if PY2: + from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + +from unittest import skipUnless from inspect import isclass from twisted.python.modules import getModule @@ -37,10 +47,12 @@ def defined_here(cls, where): """ return cls.__module__ == where + class PythonTwoRegressions(TestCase): """ Regression tests for Python 2 behaviors related to Python 3 porting. """ + @skipUnless(PY2, "No point in running on Python 3.") def test_new_style_classes(self): """ All classes in Tahoe-LAFS are new-style. diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index 4a771a4d5..18575d624 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -240,6 +240,7 @@ PORTED_TEST_MODULES = [ "allmydata.test.test_node", "allmydata.test.test_observer", "allmydata.test.test_pipeline", + "allmydata.test.test_python2_regressions", "allmydata.test.test_python3", "allmydata.test.test_repairer", "allmydata.test.test_runner",