From 877654a73c83137273adb7c26a3d38117c9dfd69 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 13 Sep 2023 12:03:19 +0300 Subject: [PATCH 1/4] gh-108303: Move `test_future` into its own subdir --- Lib/test/libregrtest/findtests.py | 1 + Lib/test/test_future_import/__init__.py | 6 ++++ .../badsyntax_future10.py | 0 .../badsyntax_future3.py | 0 .../badsyntax_future4.py | 0 .../badsyntax_future5.py | 0 .../badsyntax_future6.py | 0 .../badsyntax_future7.py | 0 .../badsyntax_future8.py | 0 .../badsyntax_future9.py | 0 .../{ => test_future_import}/future_test1.py | 0 .../{ => test_future_import}/future_test2.py | 0 .../{ => test_future_import}/test_future.py | 36 ++++++++++--------- .../{ => test_future_import}/test_future3.py | 0 .../{ => test_future_import}/test_future4.py | 0 .../{ => test_future_import}/test_future5.py | 0 Makefile.pre.in | 1 + 17 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 Lib/test/test_future_import/__init__.py rename Lib/test/{ => test_future_import}/badsyntax_future10.py (100%) rename Lib/test/{ => test_future_import}/badsyntax_future3.py (100%) rename Lib/test/{ => test_future_import}/badsyntax_future4.py (100%) rename Lib/test/{ => test_future_import}/badsyntax_future5.py (100%) rename Lib/test/{ => test_future_import}/badsyntax_future6.py (100%) rename Lib/test/{ => test_future_import}/badsyntax_future7.py (100%) rename Lib/test/{ => test_future_import}/badsyntax_future8.py (100%) rename Lib/test/{ => test_future_import}/badsyntax_future9.py (100%) rename Lib/test/{ => test_future_import}/future_test1.py (100%) rename Lib/test/{ => test_future_import}/future_test2.py (100%) rename Lib/test/{ => test_future_import}/test_future.py (92%) rename Lib/test/{ => test_future_import}/test_future3.py (100%) rename Lib/test/{ => test_future_import}/test_future4.py (100%) rename Lib/test/{ => test_future_import}/test_future5.py (100%) diff --git a/Lib/test/libregrtest/findtests.py b/Lib/test/libregrtest/findtests.py index f4a8b9ae26ae65..f296258a720289 100644 --- a/Lib/test/libregrtest/findtests.py +++ b/Lib/test/libregrtest/findtests.py @@ -18,6 +18,7 @@ SPLITTESTDIRS: set[TestName] = { "test_asyncio", "test_concurrent_futures", + "test_future_import", "test_multiprocessing_fork", "test_multiprocessing_forkserver", "test_multiprocessing_spawn", diff --git a/Lib/test/test_future_import/__init__.py b/Lib/test/test_future_import/__init__.py new file mode 100644 index 00000000000000..f2a39a3fe29c7f --- /dev/null +++ b/Lib/test/test_future_import/__init__.py @@ -0,0 +1,6 @@ +import os +from test import support + + +def load_tests(*args): + return support.load_package_tests(os.path.dirname(__file__), *args) diff --git a/Lib/test/badsyntax_future10.py b/Lib/test/test_future_import/badsyntax_future10.py similarity index 100% rename from Lib/test/badsyntax_future10.py rename to Lib/test/test_future_import/badsyntax_future10.py diff --git a/Lib/test/badsyntax_future3.py b/Lib/test/test_future_import/badsyntax_future3.py similarity index 100% rename from Lib/test/badsyntax_future3.py rename to Lib/test/test_future_import/badsyntax_future3.py diff --git a/Lib/test/badsyntax_future4.py b/Lib/test/test_future_import/badsyntax_future4.py similarity index 100% rename from Lib/test/badsyntax_future4.py rename to Lib/test/test_future_import/badsyntax_future4.py diff --git a/Lib/test/badsyntax_future5.py b/Lib/test/test_future_import/badsyntax_future5.py similarity index 100% rename from Lib/test/badsyntax_future5.py rename to Lib/test/test_future_import/badsyntax_future5.py diff --git a/Lib/test/badsyntax_future6.py b/Lib/test/test_future_import/badsyntax_future6.py similarity index 100% rename from Lib/test/badsyntax_future6.py rename to Lib/test/test_future_import/badsyntax_future6.py diff --git a/Lib/test/badsyntax_future7.py b/Lib/test/test_future_import/badsyntax_future7.py similarity index 100% rename from Lib/test/badsyntax_future7.py rename to Lib/test/test_future_import/badsyntax_future7.py diff --git a/Lib/test/badsyntax_future8.py b/Lib/test/test_future_import/badsyntax_future8.py similarity index 100% rename from Lib/test/badsyntax_future8.py rename to Lib/test/test_future_import/badsyntax_future8.py diff --git a/Lib/test/badsyntax_future9.py b/Lib/test/test_future_import/badsyntax_future9.py similarity index 100% rename from Lib/test/badsyntax_future9.py rename to Lib/test/test_future_import/badsyntax_future9.py diff --git a/Lib/test/future_test1.py b/Lib/test/test_future_import/future_test1.py similarity index 100% rename from Lib/test/future_test1.py rename to Lib/test/test_future_import/future_test1.py diff --git a/Lib/test/future_test2.py b/Lib/test/test_future_import/future_test2.py similarity index 100% rename from Lib/test/future_test2.py rename to Lib/test/test_future_import/future_test2.py diff --git a/Lib/test/test_future.py b/Lib/test/test_future_import/test_future.py similarity index 92% rename from Lib/test/test_future.py rename to Lib/test/test_future_import/test_future.py index 4730bfafbd9cfe..6efe0cd5d75e08 100644 --- a/Lib/test/test_future.py +++ b/Lib/test/test_future_import/test_future.py @@ -25,57 +25,61 @@ def check_syntax_error(self, err, basename, lineno, offset=1): self.assertEqual(err.offset, offset) def test_future1(self): - with import_helper.CleanImport('future_test1'): - from test import future_test1 + with import_helper.CleanImport('test.test_future_import.future_test1'): + from test.test_future_import import future_test1 self.assertEqual(future_test1.result, 6) def test_future2(self): - with import_helper.CleanImport('future_test2'): - from test import future_test2 + with import_helper.CleanImport('test.test_future_import.future_test2'): + from test.test_future_import import future_test2 self.assertEqual(future_test2.result, 6) def test_future3(self): - with import_helper.CleanImport('test_future3'): - from test import test_future3 + with import_helper.CleanImport('test.test_future_import.test_future3'): + from test.test_future_import import test_future3 + + def test_future4(self): + with import_helper.CleanImport('test.test_future_import.test_future4'): + from test.test_future_import import test_future4 def test_badfuture3(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future3 + from test.test_future_import import badsyntax_future3 self.check_syntax_error(cm.exception, "badsyntax_future3", 3) def test_badfuture4(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future4 + from test.test_future_import import badsyntax_future4 self.check_syntax_error(cm.exception, "badsyntax_future4", 3) def test_badfuture5(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future5 + from test.test_future_import import badsyntax_future5 self.check_syntax_error(cm.exception, "badsyntax_future5", 4) def test_badfuture6(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future6 + from test.test_future_import import badsyntax_future6 self.check_syntax_error(cm.exception, "badsyntax_future6", 3) def test_badfuture7(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future7 + from test.test_future_import import badsyntax_future7 self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 54) def test_badfuture8(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future8 + from test.test_future_import import badsyntax_future8 self.check_syntax_error(cm.exception, "badsyntax_future8", 3) def test_badfuture9(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future9 + from test.test_future_import import badsyntax_future9 self.check_syntax_error(cm.exception, "badsyntax_future9", 3) def test_badfuture10(self): with self.assertRaises(SyntaxError) as cm: - from test import badsyntax_future10 + from test.test_future_import import badsyntax_future10 self.check_syntax_error(cm.exception, "badsyntax_future10", 3) def test_ensure_flags_dont_clash(self): @@ -114,8 +118,8 @@ def test_parserhack(self): self.fail("syntax error didn't occur") def test_multiple_features(self): - with import_helper.CleanImport("test.test_future5"): - from test import test_future5 + with import_helper.CleanImport("test.test_future_import.test_future5"): + from test.test_future_import import test_future5 def test_unicode_literals_exec(self): scope = {} diff --git a/Lib/test/test_future3.py b/Lib/test/test_future_import/test_future3.py similarity index 100% rename from Lib/test/test_future3.py rename to Lib/test/test_future_import/test_future3.py diff --git a/Lib/test/test_future4.py b/Lib/test/test_future_import/test_future4.py similarity index 100% rename from Lib/test/test_future4.py rename to Lib/test/test_future_import/test_future4.py diff --git a/Lib/test/test_future5.py b/Lib/test/test_future_import/test_future5.py similarity index 100% rename from Lib/test/test_future5.py rename to Lib/test/test_future_import/test_future5.py diff --git a/Makefile.pre.in b/Makefile.pre.in index 922c9d7598003b..1ab7dc2a7113a4 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2160,6 +2160,7 @@ TESTSUBDIRS= idlelib/idle_test \ test/test_dataclasses \ test/test_email \ test/test_email/data \ + test/test_future_import \ test/test_import \ test/test_import/data \ test/test_import/data/circular_imports \ From a89f4840eb0f9891ae628847fca0c65b2f4f9710 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 14 Sep 2023 15:39:37 +0300 Subject: [PATCH 2/4] Address review --- Lib/test/libregrtest/findtests.py | 2 +- .../__init__.py | 0 .../badsyntax_future10.py | 0 .../badsyntax_future3.py | 0 .../badsyntax_future4.py | 0 .../badsyntax_future5.py | 0 .../badsyntax_future6.py | 0 .../badsyntax_future7.py | 0 .../badsyntax_future8.py | 0 .../badsyntax_future9.py | 0 .../future_test1.py | 0 .../future_test2.py | 0 .../test___future__.py | 0 .../test_future.py | 36 +++++++++---------- .../test_future3.py | 0 .../test_future4.py | 0 .../test_future5.py | 0 Makefile.pre.in | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) rename Lib/test/{test_future_import => test_import_future}/__init__.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future10.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future3.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future4.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future5.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future6.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future7.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future8.py (100%) rename Lib/test/{test_future_import => test_import_future}/badsyntax_future9.py (100%) rename Lib/test/{test_future_import => test_import_future}/future_test1.py (100%) rename Lib/test/{test_future_import => test_import_future}/future_test2.py (100%) rename Lib/test/{ => test_import_future}/test___future__.py (100%) rename Lib/test/{test_future_import => test_import_future}/test_future.py (93%) rename Lib/test/{test_future_import => test_import_future}/test_future3.py (100%) rename Lib/test/{test_future_import => test_import_future}/test_future4.py (100%) rename Lib/test/{test_future_import => test_import_future}/test_future5.py (100%) diff --git a/Lib/test/libregrtest/findtests.py b/Lib/test/libregrtest/findtests.py index f296258a720289..f6ba8b3ab2a060 100644 --- a/Lib/test/libregrtest/findtests.py +++ b/Lib/test/libregrtest/findtests.py @@ -18,7 +18,7 @@ SPLITTESTDIRS: set[TestName] = { "test_asyncio", "test_concurrent_futures", - "test_future_import", + "test_import_future", "test_multiprocessing_fork", "test_multiprocessing_forkserver", "test_multiprocessing_spawn", diff --git a/Lib/test/test_future_import/__init__.py b/Lib/test/test_import_future/__init__.py similarity index 100% rename from Lib/test/test_future_import/__init__.py rename to Lib/test/test_import_future/__init__.py diff --git a/Lib/test/test_future_import/badsyntax_future10.py b/Lib/test/test_import_future/badsyntax_future10.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future10.py rename to Lib/test/test_import_future/badsyntax_future10.py diff --git a/Lib/test/test_future_import/badsyntax_future3.py b/Lib/test/test_import_future/badsyntax_future3.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future3.py rename to Lib/test/test_import_future/badsyntax_future3.py diff --git a/Lib/test/test_future_import/badsyntax_future4.py b/Lib/test/test_import_future/badsyntax_future4.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future4.py rename to Lib/test/test_import_future/badsyntax_future4.py diff --git a/Lib/test/test_future_import/badsyntax_future5.py b/Lib/test/test_import_future/badsyntax_future5.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future5.py rename to Lib/test/test_import_future/badsyntax_future5.py diff --git a/Lib/test/test_future_import/badsyntax_future6.py b/Lib/test/test_import_future/badsyntax_future6.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future6.py rename to Lib/test/test_import_future/badsyntax_future6.py diff --git a/Lib/test/test_future_import/badsyntax_future7.py b/Lib/test/test_import_future/badsyntax_future7.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future7.py rename to Lib/test/test_import_future/badsyntax_future7.py diff --git a/Lib/test/test_future_import/badsyntax_future8.py b/Lib/test/test_import_future/badsyntax_future8.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future8.py rename to Lib/test/test_import_future/badsyntax_future8.py diff --git a/Lib/test/test_future_import/badsyntax_future9.py b/Lib/test/test_import_future/badsyntax_future9.py similarity index 100% rename from Lib/test/test_future_import/badsyntax_future9.py rename to Lib/test/test_import_future/badsyntax_future9.py diff --git a/Lib/test/test_future_import/future_test1.py b/Lib/test/test_import_future/future_test1.py similarity index 100% rename from Lib/test/test_future_import/future_test1.py rename to Lib/test/test_import_future/future_test1.py diff --git a/Lib/test/test_future_import/future_test2.py b/Lib/test/test_import_future/future_test2.py similarity index 100% rename from Lib/test/test_future_import/future_test2.py rename to Lib/test/test_import_future/future_test2.py diff --git a/Lib/test/test___future__.py b/Lib/test/test_import_future/test___future__.py similarity index 100% rename from Lib/test/test___future__.py rename to Lib/test/test_import_future/test___future__.py diff --git a/Lib/test/test_future_import/test_future.py b/Lib/test/test_import_future/test_future.py similarity index 93% rename from Lib/test/test_future_import/test_future.py rename to Lib/test/test_import_future/test_future.py index 6efe0cd5d75e08..08eb537ff659f9 100644 --- a/Lib/test/test_future_import/test_future.py +++ b/Lib/test/test_import_future/test_future.py @@ -25,61 +25,61 @@ def check_syntax_error(self, err, basename, lineno, offset=1): self.assertEqual(err.offset, offset) def test_future1(self): - with import_helper.CleanImport('test.test_future_import.future_test1'): - from test.test_future_import import future_test1 + with import_helper.CleanImport('test.test_import_future.future_test1'): + from test.test_import_future import future_test1 self.assertEqual(future_test1.result, 6) def test_future2(self): - with import_helper.CleanImport('test.test_future_import.future_test2'): - from test.test_future_import import future_test2 + with import_helper.CleanImport('test.test_import_future.future_test2'): + from test.test_import_future import future_test2 self.assertEqual(future_test2.result, 6) def test_future3(self): - with import_helper.CleanImport('test.test_future_import.test_future3'): - from test.test_future_import import test_future3 + with import_helper.CleanImport('test.test_import_future.test_future3'): + from test.test_import_future import test_future3 def test_future4(self): - with import_helper.CleanImport('test.test_future_import.test_future4'): - from test.test_future_import import test_future4 + with import_helper.CleanImport('test.test_import_future.test_future4'): + from test.test_import_future import test_future4 def test_badfuture3(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future3 + from test.test_import_future import badsyntax_future3 self.check_syntax_error(cm.exception, "badsyntax_future3", 3) def test_badfuture4(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future4 + from test.test_import_future import badsyntax_future4 self.check_syntax_error(cm.exception, "badsyntax_future4", 3) def test_badfuture5(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future5 + from test.test_import_future import badsyntax_future5 self.check_syntax_error(cm.exception, "badsyntax_future5", 4) def test_badfuture6(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future6 + from test.test_import_future import badsyntax_future6 self.check_syntax_error(cm.exception, "badsyntax_future6", 3) def test_badfuture7(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future7 + from test.test_import_future import badsyntax_future7 self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 54) def test_badfuture8(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future8 + from test.test_import_future import badsyntax_future8 self.check_syntax_error(cm.exception, "badsyntax_future8", 3) def test_badfuture9(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future9 + from test.test_import_future import badsyntax_future9 self.check_syntax_error(cm.exception, "badsyntax_future9", 3) def test_badfuture10(self): with self.assertRaises(SyntaxError) as cm: - from test.test_future_import import badsyntax_future10 + from test.test_import_future import badsyntax_future10 self.check_syntax_error(cm.exception, "badsyntax_future10", 3) def test_ensure_flags_dont_clash(self): @@ -118,8 +118,8 @@ def test_parserhack(self): self.fail("syntax error didn't occur") def test_multiple_features(self): - with import_helper.CleanImport("test.test_future_import.test_future5"): - from test.test_future_import import test_future5 + with import_helper.CleanImport("test.test_import_future.test_future5"): + from test.test_import_future import test_future5 def test_unicode_literals_exec(self): scope = {} diff --git a/Lib/test/test_future_import/test_future3.py b/Lib/test/test_import_future/test_future3.py similarity index 100% rename from Lib/test/test_future_import/test_future3.py rename to Lib/test/test_import_future/test_future3.py diff --git a/Lib/test/test_future_import/test_future4.py b/Lib/test/test_import_future/test_future4.py similarity index 100% rename from Lib/test/test_future_import/test_future4.py rename to Lib/test/test_import_future/test_future4.py diff --git a/Lib/test/test_future_import/test_future5.py b/Lib/test/test_import_future/test_future5.py similarity index 100% rename from Lib/test/test_future_import/test_future5.py rename to Lib/test/test_import_future/test_future5.py diff --git a/Makefile.pre.in b/Makefile.pre.in index 1ab7dc2a7113a4..28ddd0af6b4552 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2160,7 +2160,7 @@ TESTSUBDIRS= idlelib/idle_test \ test/test_dataclasses \ test/test_email \ test/test_email/data \ - test/test_future_import \ + test/test_import_future \ test/test_import \ test/test_import/data \ test/test_import/data/circular_imports \ From cbb0fd26b316581c340bd4d6feab8b61a3564f0b Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 14 Sep 2023 15:47:01 +0300 Subject: [PATCH 3/4] Use `test_future_stmt` --- Lib/test/libregrtest/findtests.py | 2 +- .../__init__.py | 0 .../badsyntax_future10.py | 0 .../badsyntax_future3.py | 0 .../badsyntax_future4.py | 0 .../badsyntax_future5.py | 0 .../badsyntax_future6.py | 0 .../badsyntax_future7.py | 0 .../badsyntax_future8.py | 0 .../badsyntax_future9.py | 0 .../future_test1.py | 0 .../future_test2.py | 0 .../test___future__.py | 0 .../test_future.py | 36 +++++++++---------- .../test_future3.py | 0 .../test_future4.py | 0 .../test_future5.py | 0 Makefile.pre.in | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) rename Lib/test/{test_import_future => test_future_stmt}/__init__.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future10.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future3.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future4.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future5.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future6.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future7.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future8.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/badsyntax_future9.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/future_test1.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/future_test2.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/test___future__.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/test_future.py (92%) rename Lib/test/{test_import_future => test_future_stmt}/test_future3.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/test_future4.py (100%) rename Lib/test/{test_import_future => test_future_stmt}/test_future5.py (100%) diff --git a/Lib/test/libregrtest/findtests.py b/Lib/test/libregrtest/findtests.py index f6ba8b3ab2a060..59378a48b7a3ea 100644 --- a/Lib/test/libregrtest/findtests.py +++ b/Lib/test/libregrtest/findtests.py @@ -18,7 +18,7 @@ SPLITTESTDIRS: set[TestName] = { "test_asyncio", "test_concurrent_futures", - "test_import_future", + "test_future_stmt", "test_multiprocessing_fork", "test_multiprocessing_forkserver", "test_multiprocessing_spawn", diff --git a/Lib/test/test_import_future/__init__.py b/Lib/test/test_future_stmt/__init__.py similarity index 100% rename from Lib/test/test_import_future/__init__.py rename to Lib/test/test_future_stmt/__init__.py diff --git a/Lib/test/test_import_future/badsyntax_future10.py b/Lib/test/test_future_stmt/badsyntax_future10.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future10.py rename to Lib/test/test_future_stmt/badsyntax_future10.py diff --git a/Lib/test/test_import_future/badsyntax_future3.py b/Lib/test/test_future_stmt/badsyntax_future3.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future3.py rename to Lib/test/test_future_stmt/badsyntax_future3.py diff --git a/Lib/test/test_import_future/badsyntax_future4.py b/Lib/test/test_future_stmt/badsyntax_future4.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future4.py rename to Lib/test/test_future_stmt/badsyntax_future4.py diff --git a/Lib/test/test_import_future/badsyntax_future5.py b/Lib/test/test_future_stmt/badsyntax_future5.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future5.py rename to Lib/test/test_future_stmt/badsyntax_future5.py diff --git a/Lib/test/test_import_future/badsyntax_future6.py b/Lib/test/test_future_stmt/badsyntax_future6.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future6.py rename to Lib/test/test_future_stmt/badsyntax_future6.py diff --git a/Lib/test/test_import_future/badsyntax_future7.py b/Lib/test/test_future_stmt/badsyntax_future7.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future7.py rename to Lib/test/test_future_stmt/badsyntax_future7.py diff --git a/Lib/test/test_import_future/badsyntax_future8.py b/Lib/test/test_future_stmt/badsyntax_future8.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future8.py rename to Lib/test/test_future_stmt/badsyntax_future8.py diff --git a/Lib/test/test_import_future/badsyntax_future9.py b/Lib/test/test_future_stmt/badsyntax_future9.py similarity index 100% rename from Lib/test/test_import_future/badsyntax_future9.py rename to Lib/test/test_future_stmt/badsyntax_future9.py diff --git a/Lib/test/test_import_future/future_test1.py b/Lib/test/test_future_stmt/future_test1.py similarity index 100% rename from Lib/test/test_import_future/future_test1.py rename to Lib/test/test_future_stmt/future_test1.py diff --git a/Lib/test/test_import_future/future_test2.py b/Lib/test/test_future_stmt/future_test2.py similarity index 100% rename from Lib/test/test_import_future/future_test2.py rename to Lib/test/test_future_stmt/future_test2.py diff --git a/Lib/test/test_import_future/test___future__.py b/Lib/test/test_future_stmt/test___future__.py similarity index 100% rename from Lib/test/test_import_future/test___future__.py rename to Lib/test/test_future_stmt/test___future__.py diff --git a/Lib/test/test_import_future/test_future.py b/Lib/test/test_future_stmt/test_future.py similarity index 92% rename from Lib/test/test_import_future/test_future.py rename to Lib/test/test_future_stmt/test_future.py index 08eb537ff659f9..26a39cde1ac977 100644 --- a/Lib/test/test_import_future/test_future.py +++ b/Lib/test/test_future_stmt/test_future.py @@ -25,61 +25,61 @@ def check_syntax_error(self, err, basename, lineno, offset=1): self.assertEqual(err.offset, offset) def test_future1(self): - with import_helper.CleanImport('test.test_import_future.future_test1'): - from test.test_import_future import future_test1 + with import_helper.CleanImport('test.test_future_stmt.future_test1'): + from test.test_future_stmt import future_test1 self.assertEqual(future_test1.result, 6) def test_future2(self): - with import_helper.CleanImport('test.test_import_future.future_test2'): - from test.test_import_future import future_test2 + with import_helper.CleanImport('test.test_future_stmt.future_test2'): + from test.test_future_stmt import future_test2 self.assertEqual(future_test2.result, 6) def test_future3(self): - with import_helper.CleanImport('test.test_import_future.test_future3'): - from test.test_import_future import test_future3 + with import_helper.CleanImport('test.test_future_stmt.test_future3'): + from test.test_future_stmt import test_future3 def test_future4(self): - with import_helper.CleanImport('test.test_import_future.test_future4'): - from test.test_import_future import test_future4 + with import_helper.CleanImport('test.test_future_stmt.test_future4'): + from test.test_future_stmt import test_future4 def test_badfuture3(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future3 + from test.test_future_stmt import badsyntax_future3 self.check_syntax_error(cm.exception, "badsyntax_future3", 3) def test_badfuture4(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future4 + from test.test_future_stmt import badsyntax_future4 self.check_syntax_error(cm.exception, "badsyntax_future4", 3) def test_badfuture5(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future5 + from test.test_future_stmt import badsyntax_future5 self.check_syntax_error(cm.exception, "badsyntax_future5", 4) def test_badfuture6(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future6 + from test.test_future_stmt import badsyntax_future6 self.check_syntax_error(cm.exception, "badsyntax_future6", 3) def test_badfuture7(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future7 + from test.test_future_stmt import badsyntax_future7 self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 54) def test_badfuture8(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future8 + from test.test_future_stmt import badsyntax_future8 self.check_syntax_error(cm.exception, "badsyntax_future8", 3) def test_badfuture9(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future9 + from test.test_future_stmt import badsyntax_future9 self.check_syntax_error(cm.exception, "badsyntax_future9", 3) def test_badfuture10(self): with self.assertRaises(SyntaxError) as cm: - from test.test_import_future import badsyntax_future10 + from test.test_future_stmt import badsyntax_future10 self.check_syntax_error(cm.exception, "badsyntax_future10", 3) def test_ensure_flags_dont_clash(self): @@ -118,8 +118,8 @@ def test_parserhack(self): self.fail("syntax error didn't occur") def test_multiple_features(self): - with import_helper.CleanImport("test.test_import_future.test_future5"): - from test.test_import_future import test_future5 + with import_helper.CleanImport("test.test_future_stmt.test_future5"): + from test.test_future_stmt import test_future5 def test_unicode_literals_exec(self): scope = {} diff --git a/Lib/test/test_import_future/test_future3.py b/Lib/test/test_future_stmt/test_future3.py similarity index 100% rename from Lib/test/test_import_future/test_future3.py rename to Lib/test/test_future_stmt/test_future3.py diff --git a/Lib/test/test_import_future/test_future4.py b/Lib/test/test_future_stmt/test_future4.py similarity index 100% rename from Lib/test/test_import_future/test_future4.py rename to Lib/test/test_future_stmt/test_future4.py diff --git a/Lib/test/test_import_future/test_future5.py b/Lib/test/test_future_stmt/test_future5.py similarity index 100% rename from Lib/test/test_import_future/test_future5.py rename to Lib/test/test_future_stmt/test_future5.py diff --git a/Makefile.pre.in b/Makefile.pre.in index 28ddd0af6b4552..ba35e1b563ce26 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2160,7 +2160,7 @@ TESTSUBDIRS= idlelib/idle_test \ test/test_dataclasses \ test/test_email \ test/test_email/data \ - test/test_import_future \ + test/test_future_stmt \ test/test_import \ test/test_import/data \ test/test_import/data/circular_imports \ From 80c393615234488767ce1328df80e953e9d67dde Mon Sep 17 00:00:00 2001 From: sobolevn Date: Fri, 15 Sep 2023 10:01:45 +0300 Subject: [PATCH 4/4] Rename files --- Lib/test/test_future_stmt/test_future.py | 28 +++++++++++-------- ...est___future__.py => test_future_flags.py} | 0 ...e5.py => test_future_multiple_features.py} | 0 ...re4.py => test_future_multiple_imports.py} | 0 ...uture3.py => test_future_single_import.py} | 0 5 files changed, 17 insertions(+), 11 deletions(-) rename Lib/test/test_future_stmt/{test___future__.py => test_future_flags.py} (100%) rename Lib/test/test_future_stmt/{test_future5.py => test_future_multiple_features.py} (100%) rename Lib/test/test_future_stmt/{test_future4.py => test_future_multiple_imports.py} (100%) rename Lib/test/test_future_stmt/{test_future3.py => test_future_single_import.py} (100%) diff --git a/Lib/test/test_future_stmt/test_future.py b/Lib/test/test_future_stmt/test_future.py index 26a39cde1ac977..8e67bcd72c91c5 100644 --- a/Lib/test/test_future_stmt/test_future.py +++ b/Lib/test/test_future_stmt/test_future.py @@ -34,13 +34,23 @@ def test_future2(self): from test.test_future_stmt import future_test2 self.assertEqual(future_test2.result, 6) - def test_future3(self): - with import_helper.CleanImport('test.test_future_stmt.test_future3'): - from test.test_future_stmt import test_future3 - - def test_future4(self): - with import_helper.CleanImport('test.test_future_stmt.test_future4'): - from test.test_future_stmt import test_future4 + def test_future_single_import(self): + with import_helper.CleanImport( + 'test.test_future_stmt.test_future_single_import', + ): + from test.test_future_stmt import test_future_single_import + + def test_future_multiple_imports(self): + with import_helper.CleanImport( + 'test.test_future_stmt.test_future_multiple_imports', + ): + from test.test_future_stmt import test_future_multiple_imports + + def test_future_multiple_features(self): + with import_helper.CleanImport( + "test.test_future_stmt.test_future_multiple_features", + ): + from test.test_future_stmt import test_future_multiple_features def test_badfuture3(self): with self.assertRaises(SyntaxError) as cm: @@ -117,10 +127,6 @@ def test_parserhack(self): else: self.fail("syntax error didn't occur") - def test_multiple_features(self): - with import_helper.CleanImport("test.test_future_stmt.test_future5"): - from test.test_future_stmt import test_future5 - def test_unicode_literals_exec(self): scope = {} exec("from __future__ import unicode_literals; x = ''", {}, scope) diff --git a/Lib/test/test_future_stmt/test___future__.py b/Lib/test/test_future_stmt/test_future_flags.py similarity index 100% rename from Lib/test/test_future_stmt/test___future__.py rename to Lib/test/test_future_stmt/test_future_flags.py diff --git a/Lib/test/test_future_stmt/test_future5.py b/Lib/test/test_future_stmt/test_future_multiple_features.py similarity index 100% rename from Lib/test/test_future_stmt/test_future5.py rename to Lib/test/test_future_stmt/test_future_multiple_features.py diff --git a/Lib/test/test_future_stmt/test_future4.py b/Lib/test/test_future_stmt/test_future_multiple_imports.py similarity index 100% rename from Lib/test/test_future_stmt/test_future4.py rename to Lib/test/test_future_stmt/test_future_multiple_imports.py diff --git a/Lib/test/test_future_stmt/test_future3.py b/Lib/test/test_future_stmt/test_future_single_import.py similarity index 100% rename from Lib/test/test_future_stmt/test_future3.py rename to Lib/test/test_future_stmt/test_future_single_import.py