Skip to content

Commit 82505dc

Browse files
authored
gh-108303: Move test_future into its own test_future_stmt subdir (#109368)
1 parent fa49390 commit 82505dc

18 files changed

+37
-19
lines changed

Lib/test/libregrtest/findtests.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
SPLITTESTDIRS: set[TestName] = {
1919
"test_asyncio",
2020
"test_concurrent_futures",
21+
"test_future_stmt",
2122
"test_multiprocessing_fork",
2223
"test_multiprocessing_forkserver",
2324
"test_multiprocessing_spawn",

Lib/test/test_future_stmt/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import os
2+
from test import support
3+
4+
5+
def load_tests(*args):
6+
return support.load_package_tests(os.path.dirname(__file__), *args)
File renamed without changes.
File renamed without changes.

Lib/test/test_future.py renamed to Lib/test/test_future_stmt/test_future.py

+29-19
Original file line numberDiff line numberDiff line change
@@ -25,57 +25,71 @@ def check_syntax_error(self, err, basename, lineno, offset=1):
2525
self.assertEqual(err.offset, offset)
2626

2727
def test_future1(self):
28-
with import_helper.CleanImport('future_test1'):
29-
from test import future_test1
28+
with import_helper.CleanImport('test.test_future_stmt.future_test1'):
29+
from test.test_future_stmt import future_test1
3030
self.assertEqual(future_test1.result, 6)
3131

3232
def test_future2(self):
33-
with import_helper.CleanImport('future_test2'):
34-
from test import future_test2
33+
with import_helper.CleanImport('test.test_future_stmt.future_test2'):
34+
from test.test_future_stmt import future_test2
3535
self.assertEqual(future_test2.result, 6)
3636

37-
def test_future3(self):
38-
with import_helper.CleanImport('test_future3'):
39-
from test import test_future3
37+
def test_future_single_import(self):
38+
with import_helper.CleanImport(
39+
'test.test_future_stmt.test_future_single_import',
40+
):
41+
from test.test_future_stmt import test_future_single_import
42+
43+
def test_future_multiple_imports(self):
44+
with import_helper.CleanImport(
45+
'test.test_future_stmt.test_future_multiple_imports',
46+
):
47+
from test.test_future_stmt import test_future_multiple_imports
48+
49+
def test_future_multiple_features(self):
50+
with import_helper.CleanImport(
51+
"test.test_future_stmt.test_future_multiple_features",
52+
):
53+
from test.test_future_stmt import test_future_multiple_features
4054

4155
def test_badfuture3(self):
4256
with self.assertRaises(SyntaxError) as cm:
43-
from test import badsyntax_future3
57+
from test.test_future_stmt import badsyntax_future3
4458
self.check_syntax_error(cm.exception, "badsyntax_future3", 3)
4559

4660
def test_badfuture4(self):
4761
with self.assertRaises(SyntaxError) as cm:
48-
from test import badsyntax_future4
62+
from test.test_future_stmt import badsyntax_future4
4963
self.check_syntax_error(cm.exception, "badsyntax_future4", 3)
5064

5165
def test_badfuture5(self):
5266
with self.assertRaises(SyntaxError) as cm:
53-
from test import badsyntax_future5
67+
from test.test_future_stmt import badsyntax_future5
5468
self.check_syntax_error(cm.exception, "badsyntax_future5", 4)
5569

5670
def test_badfuture6(self):
5771
with self.assertRaises(SyntaxError) as cm:
58-
from test import badsyntax_future6
72+
from test.test_future_stmt import badsyntax_future6
5973
self.check_syntax_error(cm.exception, "badsyntax_future6", 3)
6074

6175
def test_badfuture7(self):
6276
with self.assertRaises(SyntaxError) as cm:
63-
from test import badsyntax_future7
77+
from test.test_future_stmt import badsyntax_future7
6478
self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 54)
6579

6680
def test_badfuture8(self):
6781
with self.assertRaises(SyntaxError) as cm:
68-
from test import badsyntax_future8
82+
from test.test_future_stmt import badsyntax_future8
6983
self.check_syntax_error(cm.exception, "badsyntax_future8", 3)
7084

7185
def test_badfuture9(self):
7286
with self.assertRaises(SyntaxError) as cm:
73-
from test import badsyntax_future9
87+
from test.test_future_stmt import badsyntax_future9
7488
self.check_syntax_error(cm.exception, "badsyntax_future9", 3)
7589

7690
def test_badfuture10(self):
7791
with self.assertRaises(SyntaxError) as cm:
78-
from test import badsyntax_future10
92+
from test.test_future_stmt import badsyntax_future10
7993
self.check_syntax_error(cm.exception, "badsyntax_future10", 3)
8094

8195
def test_ensure_flags_dont_clash(self):
@@ -113,10 +127,6 @@ def test_parserhack(self):
113127
else:
114128
self.fail("syntax error didn't occur")
115129

116-
def test_multiple_features(self):
117-
with import_helper.CleanImport("test.test_future5"):
118-
from test import test_future5
119-
120130
def test_unicode_literals_exec(self):
121131
scope = {}
122132
exec("from __future__ import unicode_literals; x = ''", {}, scope)

Makefile.pre.in

+1
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,7 @@ TESTSUBDIRS= idlelib/idle_test \
21602160
test/test_dataclasses \
21612161
test/test_email \
21622162
test/test_email/data \
2163+
test/test_future_stmt \
21632164
test/test_import \
21642165
test/test_import/data \
21652166
test/test_import/data/circular_imports \

0 commit comments

Comments
 (0)