diff --git a/Lib/test/libregrtest/runtest.py b/Lib/test/libregrtest/runtest.py index e73a8f1a855dc1..c85d73170ba559 100644 --- a/Lib/test/libregrtest/runtest.py +++ b/Lib/test/libregrtest/runtest.py @@ -141,6 +141,7 @@ def set_env_changed(self): SPLITTESTDIRS = { "test_asyncio", + "test_future_stmt", } # Storage of uncollectable objects diff --git a/Lib/test/test_future_stmt/__init__.py b/Lib/test/test_future_stmt/__init__.py new file mode 100644 index 00000000000000..f2a39a3fe29c7f --- /dev/null +++ b/Lib/test/test_future_stmt/__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_stmt/badsyntax_future10.py similarity index 100% rename from Lib/test/badsyntax_future10.py rename to Lib/test/test_future_stmt/badsyntax_future10.py diff --git a/Lib/test/badsyntax_future3.py b/Lib/test/test_future_stmt/badsyntax_future3.py similarity index 100% rename from Lib/test/badsyntax_future3.py rename to Lib/test/test_future_stmt/badsyntax_future3.py diff --git a/Lib/test/badsyntax_future4.py b/Lib/test/test_future_stmt/badsyntax_future4.py similarity index 100% rename from Lib/test/badsyntax_future4.py rename to Lib/test/test_future_stmt/badsyntax_future4.py diff --git a/Lib/test/badsyntax_future5.py b/Lib/test/test_future_stmt/badsyntax_future5.py similarity index 100% rename from Lib/test/badsyntax_future5.py rename to Lib/test/test_future_stmt/badsyntax_future5.py diff --git a/Lib/test/badsyntax_future6.py b/Lib/test/test_future_stmt/badsyntax_future6.py similarity index 100% rename from Lib/test/badsyntax_future6.py rename to Lib/test/test_future_stmt/badsyntax_future6.py diff --git a/Lib/test/badsyntax_future7.py b/Lib/test/test_future_stmt/badsyntax_future7.py similarity index 100% rename from Lib/test/badsyntax_future7.py rename to Lib/test/test_future_stmt/badsyntax_future7.py diff --git a/Lib/test/badsyntax_future8.py b/Lib/test/test_future_stmt/badsyntax_future8.py similarity index 100% rename from Lib/test/badsyntax_future8.py rename to Lib/test/test_future_stmt/badsyntax_future8.py diff --git a/Lib/test/badsyntax_future9.py b/Lib/test/test_future_stmt/badsyntax_future9.py similarity index 100% rename from Lib/test/badsyntax_future9.py rename to Lib/test/test_future_stmt/badsyntax_future9.py diff --git a/Lib/test/future_test1.py b/Lib/test/test_future_stmt/future_test1.py similarity index 100% rename from Lib/test/future_test1.py rename to Lib/test/test_future_stmt/future_test1.py diff --git a/Lib/test/future_test2.py b/Lib/test/test_future_stmt/future_test2.py similarity index 100% rename from Lib/test/future_test2.py rename to Lib/test/test_future_stmt/future_test2.py diff --git a/Lib/test/test_future.py b/Lib/test/test_future_stmt/test_future.py similarity index 91% rename from Lib/test/test_future.py rename to Lib/test/test_future_stmt/test_future.py index c3e8420d6672c5..13cee3ff6e49da 100644 --- a/Lib/test/test_future.py +++ b/Lib/test/test_future_stmt/test_future.py @@ -25,57 +25,71 @@ 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_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('future_test2'): - from test 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_future3'): - from test import test_future3 + 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: - from test 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 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 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 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 import badsyntax_future7 + from test.test_future_stmt import badsyntax_future7 self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 53) def test_badfuture8(self): with self.assertRaises(SyntaxError) as cm: - from test 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 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 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): @@ -113,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_future5"): - from test 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__.py b/Lib/test/test_future_stmt/test_future_flags.py similarity index 100% rename from Lib/test/test___future__.py rename to Lib/test/test_future_stmt/test_future_flags.py diff --git a/Lib/test/test_future5.py b/Lib/test/test_future_stmt/test_future_multiple_features.py similarity index 100% rename from Lib/test/test_future5.py rename to Lib/test/test_future_stmt/test_future_multiple_features.py diff --git a/Lib/test/test_future4.py b/Lib/test/test_future_stmt/test_future_multiple_imports.py similarity index 100% rename from Lib/test/test_future4.py rename to Lib/test/test_future_stmt/test_future_multiple_imports.py diff --git a/Lib/test/test_future3.py b/Lib/test/test_future_stmt/test_future_single_import.py similarity index 100% rename from Lib/test/test_future3.py rename to Lib/test/test_future_stmt/test_future_single_import.py diff --git a/Makefile.pre.in b/Makefile.pre.in index 99b1be2206c723..34e7ff5e732fab 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1964,6 +1964,7 @@ TESTSUBDIRS= ctypes/test \ test/test_cppext \ test/test_email \ test/test_email/data \ + test/test_future_stmt \ test/test_import \ test/test_import/data \ test/test_import/data/circular_imports \