Skip to content

Commit 913b78c

Browse files
committed
Revert "Merge pull request RustPython#3433 from deantvv/test-update"
This reverts commit 9fa5c5a, reversing changes made to e7fa32c.
1 parent 9fa5c5a commit 913b78c

File tree

98 files changed

+2060
-2927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2060
-2927
lines changed

Lib/test/libregrtest/cmdline.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import os
33
import sys
44
from test import support
5-
from test.support import os_helper
65

76

87
USAGE = """\
@@ -281,7 +280,7 @@ def _create_parser():
281280
def relative_filename(string):
282281
# CWD is replaced with a temporary dir before calling main(), so we
283282
# join it with the saved CWD so it ends up where the user expects.
284-
return os.path.join(os_helper.SAVEDCWD, string)
283+
return os.path.join(support.SAVEDCWD, string)
285284

286285

287286
def huntrleaks(string):

Lib/test/libregrtest/main.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from test.libregrtest.setup import setup_tests
2121
from test.libregrtest.utils import removepy, count, format_duration, printlist
2222
from test import support
23-
from test.support import os_helper
2423

2524

2625
# When tests are run from the Python build directory, it is best practice
@@ -200,7 +199,7 @@ def find_tests(self, tests):
200199
# regex to match 'test_builtin' in line:
201200
# '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec'
202201
regex = re.compile(r'\btest_[a-zA-Z0-9_]+\b')
203-
with open(os.path.join(os_helper.SAVEDCWD, self.ns.fromfile)) as fp:
202+
with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp:
204203
for line in fp:
205204
line = line.split('#', 1)[0]
206205
line = line.strip()
@@ -543,7 +542,7 @@ def save_xml_result(self):
543542
for k, v in totals.items():
544543
root.set(k, str(v))
545544

546-
xmlpath = os.path.join(os_helper.SAVEDCWD, self.ns.xmlpath)
545+
xmlpath = os.path.join(support.SAVEDCWD, self.ns.xmlpath)
547546
with open(xmlpath, 'wb') as f:
548547
for s in ET.tostringlist(root):
549548
f.write(s)
@@ -569,8 +568,8 @@ def main(self, tests=None, **kwargs):
569568
# Run the tests in a context manager that temporarily changes the CWD to a
570569
# temporary and writable directory. If it's not possible to create or
571570
# change the CWD, the original CWD will be used. The original CWD is
572-
# available from os_helper.SAVEDCWD.
573-
with os_helper.temp_cwd(test_cwd, quiet=True):
571+
# available from support.SAVEDCWD.
572+
with support.temp_cwd(test_cwd, quiet=True):
574573
self._main(tests, kwargs)
575574

576575
def getloadavg(self):

Lib/test/libregrtest/refleak.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def get_pooled_int(value):
6161
return int_pool.setdefault(value, value)
6262

6363
nwarmup, ntracked, fname = ns.huntrleaks
64-
fname = os.path.join(os_helper.SAVEDCWD, fname)
64+
fname = os.path.join(support.SAVEDCWD, fname)
6565
repcount = nwarmup + ntracked
6666

6767
# Pre-allocate to ensure that the loop doesn't allocate anything new

Lib/test/libregrtest/runtest.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import unittest
1212

1313
from test import support
14-
from test.support import os_helper
1514
from test.libregrtest.refleak import dash_R, clear_caches
1615
from test.libregrtest.save_env import saved_test_environment
1716
from test.libregrtest.utils import print_warning
@@ -299,7 +298,7 @@ def cleanup_test_droppings(test_name, verbose):
299298
# since if a test leaves a file open, it cannot be deleted by name (while
300299
# there's nothing we can do about that here either, we can display the
301300
# name of the offending test, which is a real help).
302-
for name in (os_helper.TESTFN,
301+
for name in (support.TESTFN,
303302
"db_home",
304303
):
305304
if not os.path.exists(name):

Lib/test/libregrtest/runtest_mp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def run_test_in_subprocess(testname, ns):
4646
stderr=subprocess.PIPE,
4747
universal_newlines=True,
4848
close_fds=(os.name != 'nt'),
49-
cwd=os_helper.SAVEDCWD)
49+
cwd=support.SAVEDCWD)
5050

5151

5252
def run_tests_worker(worker_args):

Lib/test/libregrtest/save_env.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import threading
1010
import warnings
1111
from test import support
12-
from test.support import os_helper
1312
from test.libregrtest.utils import print_warning
1413
try:
1514
import _multiprocessing, multiprocessing.process
@@ -229,12 +228,12 @@ def get_files(self):
229228
return sorted(fn + ('/' if os.path.isdir(fn) else '')
230229
for fn in os.listdir())
231230
def restore_files(self, saved_value):
232-
fn = os_helper.TESTFN
231+
fn = support.TESTFN
233232
if fn not in saved_value and (fn + '/') not in saved_value:
234233
if os.path.isfile(fn):
235-
os_helper.unlink(fn)
234+
support.unlink(fn)
236235
elif os.path.isdir(fn):
237-
os_helper.rmtree(fn)
236+
support.rmtree(fn)
238237

239238
_lc = [getattr(locale, lc) for lc in dir(locale)
240239
if lc.startswith('LC_')]

Lib/test/libregrtest/win_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def start(self):
5555

5656
# Spawn off the load monitor
5757
command = ['typeperf', COUNTER_NAME, '-si', str(SAMPLING_INTERVAL)]
58-
self.p = subprocess.Popen(command, stdout=command_stdout, cwd=os_helper.SAVEDCWD)
58+
self.p = subprocess.Popen(command, stdout=command_stdout, cwd=support.SAVEDCWD)
5959

6060
# Close our copy of the write end of the pipe
6161
os.close(command_stdout)

Lib/test/list_tests.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from functools import cmp_to_key
99

1010
from test import support, seq_tests
11-
from test.support import os_helper
1211

1312

1413
class CommonTest(seq_tests.CommonTest):
@@ -74,12 +73,12 @@ def test_print(self):
7473
d.append(d)
7574
d.append(400)
7675
try:
77-
with open(os_helper.TESTFN, "w") as fo:
76+
with open(support.TESTFN, "w") as fo:
7877
fo.write(str(d))
79-
with open(os_helper.TESTFN, "r") as fo:
78+
with open(support.TESTFN, "r") as fo:
8079
self.assertEqual(fo.read(), repr(d))
8180
finally:
82-
os.remove(os_helper.TESTFN)
81+
os.remove(support.TESTFN)
8382

8483
def test_set_subscript(self):
8584
a = self.type2test(range(20))

0 commit comments

Comments
 (0)