Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5baa8af

Browse filesBrowse files
vstinnersobolevn
andauthored
[3.12] gh-108303: Move test_future into its own test_future_stmt subdir (#109368) (#109679)
gh-108303: Move `test_future` into its own test_future_stmt subdir (#109368) (cherry picked from commit 82505dc) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent ed4ffd7 commit 5baa8af
Copy full SHA for 5baa8af

18 files changed

+37
-19
lines changed

‎Lib/test/libregrtest/runtest.py

Copy file name to clipboardExpand all lines: Lib/test/libregrtest/runtest.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def iter_tests(self):
232232
SPLITTESTDIRS = {
233233
"test_asyncio",
234234
"test_concurrent_futures",
235+
"test_future_stmt",
235236
"test_multiprocessing_fork",
236237
"test_multiprocessing_forkserver",
237238
"test_multiprocessing_spawn",

‎Lib/test/test_future_stmt/__init__.py

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
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

Copy file name to clipboardExpand all lines: Lib/test/test_future_stmt/test_future.py
+29-19Lines changed: 29 additions & 19 deletions
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

Copy file name to clipboardExpand all lines: Makefile.pre.in
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,7 @@ TESTSUBDIRS= idlelib/idle_test \
21372137
test/test_dataclasses \
21382138
test/test_email \
21392139
test/test_email/data \
2140+
test/test_future_stmt \
21402141
test/test_import \
21412142
test/test_import/data \
21422143
test/test_import/data/circular_imports \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.