@@ -1,4 +1,4 @@
-from tests.package.test_python import TestPythonInterpreter, TestPythonBase
+from tests.package.test_python import TestPythonInterpreter, TestPythonBase2, TestPythonBase3
#
# The following pythong tests are not being used here:
#
@@ -17,17 +17,15 @@ class TestIPython(TestPythonInterpreter):
self.libc_time_test(40)
-class TestIPythonPy2(TestIPython, TestPythonBase):
- config = TestPythonBase.config + \
+class TestIPythonPy2(TestIPython, TestPythonBase2):
+ config = TestPythonBase2.config + \
"""
- BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_IPYTHON=y
"""
-class TestIPythonPy3(TestIPython, TestPythonBase):
- config = TestPythonBase.config + \
+class TestIPythonPy3(TestIPython, TestPythonBase3):
+ config = TestPythonBase3.config + \
"""
- BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_IPYTHON=y
"""
@@ -19,6 +19,20 @@ class TestPythonBase(infra.basetest.BRTest):
self.emulator.login()
+class TestPythonBase2(TestPythonBase):
+ config = TestPythonBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ """
+
+
+class TestPythonBase3(TestPythonBase):
+ config = TestPythonBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ """
+
+
class TestPythonInterpreter():
version_string = None
@@ -53,17 +67,9 @@ class TestPythonInterpreter():
self.zlib_test()
-class TestPython2(TestPythonInterpreter, TestPythonBase):
- config = TestPythonBase.config + \
- """
- BR2_PACKAGE_PYTHON=y
- """
+class TestPython2(TestPythonInterpreter, TestPythonBase2):
version_string = "Python 2"
-class TestPython3(TestPythonInterpreter, TestPythonBase):
- config = TestPythonBase.config + \
- """
- BR2_PACKAGE_PYTHON3=y
- """
+class TestPython3(TestPythonInterpreter, TestPythonBase3):
version_string = "Python 3"
@@ -1,4 +1,4 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonBase, TestPythonBase2, TestPythonBase3
class TestPythonAutobahn(TestPythonBase):
@@ -8,10 +8,9 @@ class TestPythonAutobahn(TestPythonBase):
self.assertEqual(exit_code, 0)
-class TestPythonPy2Autobahn(TestPythonAutobahn):
- config = TestPythonBase.config + \
+class TestPythonPy2Autobahn(TestPythonAutobahn, TestPythonBase2):
+ config = TestPythonBase2.config + \
"""
- BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_AUTOBAHN=y
"""
@@ -20,10 +19,9 @@ class TestPythonPy2Autobahn(TestPythonAutobahn):
self.import_test()
-class TestPythonPy3Autobahn(TestPythonAutobahn):
- config = TestPythonBase.config + \
+class TestPythonPy3Autobahn(TestPythonAutobahn, TestPythonBase3):
+ config = TestPythonBase3.config + \
"""
- BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_AUTOBAHN=y
"""
@@ -1,4 +1,4 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonBase, TestPythonBase2, TestPythonBase3
class TestPythonCryptography(TestPythonBase):
@@ -10,10 +10,9 @@ class TestPythonCryptography(TestPythonBase):
self.assertEqual(exit_code, 0)
-class TestPythonPy2Cryptography(TestPythonCryptography):
- config = TestPythonBase.config + \
+class TestPythonPy2Cryptography(TestPythonCryptography, TestPythonBase2):
+ config = TestPythonBase2.config + \
"""
- BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
"""
@@ -22,10 +21,9 @@ class TestPythonPy2Cryptography(TestPythonCryptography):
self.fernet_test(40)
-class TestPythonPy3Cryptography(TestPythonCryptography):
- config = TestPythonBase.config + \
+class TestPythonPy3Cryptography(TestPythonCryptography, TestPythonBase3):
+ config = TestPythonBase3.config + \
"""
- BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
"""
@@ -1,4 +1,4 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonBase, TestPythonBase2, TestPythonBase3
class TestPythonIncremental(TestPythonBase):
@@ -10,10 +10,9 @@ class TestPythonIncremental(TestPythonBase):
self.assertEqual(exit_code, 0)
-class TestPythonPy2Incremental(TestPythonIncremental):
- config = TestPythonBase.config + \
+class TestPythonPy2Incremental(TestPythonIncremental, TestPythonBase2):
+ config = TestPythonBase2.config + \
"""
- BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_INCREMENTAL=y
"""
@@ -22,10 +21,9 @@ class TestPythonPy2Incremental(TestPythonIncremental):
self.str_test()
-class TestPythonPy3Incremental(TestPythonIncremental):
- config = TestPythonBase.config + \
+class TestPythonPy3Incremental(TestPythonIncremental, TestPythonBase3):
+ config = TestPythonBase3.config + \
"""
- BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_INCREMENTAL=y
"""
@@ -1,4 +1,4 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonBase, TestPythonBase2, TestPythonBase3
TEST_SCRIPT = """
from twisted.internet import protocol, reactor, endpoints
@@ -30,10 +30,9 @@ class TestPythonTwisted(TestPythonBase):
self.assertEqual(exit_code, 0)
-class TestPythonPy2Twisted(TestPythonTwisted):
- config = TestPythonBase.config + \
+class TestPythonPy2Twisted(TestPythonTwisted, TestPythonBase2):
+ config = TestPythonBase2.config + \
"""
- BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_TWISTED=y
"""
@@ -42,10 +41,9 @@ class TestPythonPy2Twisted(TestPythonTwisted):
self.import_test()
-class TestPythonPy3Twisted(TestPythonTwisted):
- config = TestPythonBase.config + \
+class TestPythonPy3Twisted(TestPythonTwisted, TestPythonBase3):
+ config = TestPythonBase3.config + \
"""
- BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_TWISTED=y
"""
@@ -1,10 +1,9 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonBase2, TestPythonBase3
-class TestPythonPy2Txaio(TestPythonBase):
- config = TestPythonBase.config + \
+class TestPythonPy2Txaio(TestPythonBase2):
+ config = TestPythonBase2.config + \
"""
- BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_TXAIO=y
BR2_PACKAGE_PYTHON_TWISTED=y
"""
@@ -18,10 +17,9 @@ class TestPythonPy2Txaio(TestPythonBase):
self.assertEqual(exit_code, 0)
-class TestPythonPy3Txaio(TestPythonBase):
- config = TestPythonBase.config + \
+class TestPythonPy3Txaio(TestPythonBase3):
+ config = TestPythonBase3.config + \
"""
- BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_TXAIO=y
"""
@@ -1,4 +1,4 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonBase, TestPythonBase2, TestPythonBase3
class TestPythonTxtorcon(TestPythonBase):
@@ -8,10 +8,9 @@ class TestPythonTxtorcon(TestPythonBase):
self.assertEqual(exit_code, 0)
-class TestPythonPy2Txtorcon(TestPythonTxtorcon):
- config = TestPythonBase.config + \
+class TestPythonPy2Txtorcon(TestPythonTxtorcon, TestPythonBase2):
+ config = TestPythonBase2.config + \
"""
- BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_TXTORCON=y
"""
@@ -20,10 +19,9 @@ class TestPythonPy2Txtorcon(TestPythonTxtorcon):
self.import_test()
-class TestPythonPy3Txtorcon(TestPythonTxtorcon):
- config = TestPythonBase.config + \
+class TestPythonPy3Txtorcon(TestPythonTxtorcon, TestPythonBase3):
+ config = TestPythonBase3.config + \
"""
- BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_TXTORCON=y
"""
Currently all test cases for python packages add BR2_PACKAGE_PYTHON=y or BR2_PACKAGE_PYTHON3=y by their own. Move those configs to two intermediate classes named TestPythonBase2 and TestPythonBase3, and change all test cases that need those configs to get them through the new classes. A few classes still need to inherit directly from TestPythonBase. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Asaf Kahlon <asafka7@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Yegor Yefremov <yegorslists@googlemail.com> --- Changes v1 -> v2: - new patch to gradually prepare the current python test cases to receive the new class TestPythonPackageBase (see review of http://patchwork.ozlabs.org/patch/984425/); --- support/testing/tests/package/test_ipython.py | 12 ++++----- support/testing/tests/package/test_python.py | 26 ++++++++++++------- .../tests/package/test_python_autobahn.py | 12 ++++----- .../tests/package/test_python_cryptography.py | 12 ++++----- .../tests/package/test_python_incremental.py | 12 ++++----- .../tests/package/test_python_twisted.py | 12 ++++----- .../tests/package/test_python_txaio.py | 12 ++++----- .../tests/package/test_python_txtorcon.py | 12 ++++----- 8 files changed, 51 insertions(+), 59 deletions(-)