From d368a96a9276f49f15d0aa6daa60fc87ddcd5a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Duraffort?= Date: Tue, 9 Aug 2016 15:57:09 +0200 Subject: Port to python3 Change-Id: I8f148b619870f9b057e24febef92fb217a1a97f7 --- django_testscenarios/tests.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/django_testscenarios/tests.py b/django_testscenarios/tests.py index ebf68b3..f9a1318 100644 --- a/django_testscenarios/tests.py +++ b/django_testscenarios/tests.py @@ -121,6 +121,8 @@ class TestsWorkWithTestToolsTestCase(TestCase, * plain database checks * test tools test case """ + def __hash__(self): + return hash(repr(self)) class TestsWorkWithTestScenariosTestCaseAndNoScenarios(TestCaseWithScenarios, @@ -132,6 +134,8 @@ class TestsWorkWithTestScenariosTestCaseAndNoScenarios(TestCaseWithScenarios, * test scenarios test case * no actual scenarios (short-circuited fast path) """ + def __hash__(self): + return hash(repr(self)) class TestsWorkWithTestScenariosTestCaseAndSomeScenarios(TestCaseWithScenarios, @@ -144,6 +148,8 @@ class TestsWorkWithTestScenariosTestCaseAndSomeScenarios(TestCaseWithScenarios, * test scenarios test case * two dummy scenarios so that multiple test cases get generated """ + def __hash__(self): + return hash(repr(self)) # Transaction tests @@ -157,6 +163,8 @@ class TransactionsWorkWithPlainDjangoTestCase(DjangoTransactionTestCase, * database transactions * django test case (with transaction support) """ + def __hash__(self): + return hash(repr(self)) class TransactionsWorkWithTestToolsTestCase(TransactionTestCase, @@ -167,6 +175,8 @@ class TransactionsWorkWithTestToolsTestCase(TransactionTestCase, * database transactions * test tools test case (with transaction support) """ + def __hash__(self): + return hash(repr(self)) class TransactionsWorkWithTestScenariosTestCaseAndNoScenarios(TransactionTestCaseWithScenarios, @@ -179,6 +189,8 @@ class TransactionsWorkWithTestScenariosTestCaseAndNoScenarios(TransactionTestCas * test scenarios test case (with transaction support) * no actual scenarios (short-circuited fast path) """ + def __hash__(self): + return hash(repr(self)) class TransactionsWorkWithTestScenariosTestCaseAndSomeScenarios(TransactionTestCaseWithScenarios, @@ -192,6 +204,8 @@ class TransactionsWorkWithTestScenariosTestCaseAndSomeScenarios(TransactionTestC * test scenarios test case (with transaction support) * two dummy scenarios so that multiple test cases get generated """ + def __hash__(self): + return hash(repr(self)) class TestReorderingNotBroken(DjangoTestCase): @@ -203,23 +217,31 @@ class TestReorderingNotBroken(DjangoTestCase): class Plain(TestCase): """" Empty test class inheriting from TestCase """ + def __hash__(self): + return hash(repr(self)) def runTest(self, result): pass class PlainScenarios(TestCaseWithScenarios): + def __hash__(self): + return hash(repr(self)) def runTest(self, result): pass class Transaction(TransactionTestCase): """" Empty test class inheriting from TransactionTestCase """ + def __hash__(self): + return hash(repr(self)) def runTest(self, result): pass class TransactionScenarios(TransactionTestCaseWithScenarios): """" Empty test class inheriting from TransactionTestCase """ + def __hash__(self): + return hash(repr(self)) def runTest(self, result): pass @@ -236,7 +258,7 @@ class TestReorderingNotBroken(DjangoTestCase): for cls in initial_order: suite.addTest(cls()) reordered_suite = reorder_suite(suite, (DjangoTestCase,)) - self.assertEqual(map(type, reordered_suite._tests), proper_order) + self.assertEqual(list(map(type, reordered_suite._tests)), proper_order) def test_transaction_test_case_stays_last(self): self.ensure_proper_order( -- cgit v1.2.3