summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_linecache.py
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2020-07-06 09:15:08 (GMT)
committerGitHub <noreply@github.com>2020-07-06 09:15:08 (GMT)
commita089d21df1ea502b995d8e8a3bcc937cce030802 (patch)
tree0ca48d704e4b63bd7090483a24879a09e1f911eb /Lib/test/test_linecache.py
parent883bc638335a57a6e6a6344c2fc132c4f9a0ec42 (diff)
downloadcpython-a089d21df1ea502b995d8e8a3bcc937cce030802.zip
cpython-a089d21df1ea502b995d8e8a3bcc937cce030802.tar.gz
cpython-a089d21df1ea502b995d8e8a3bcc937cce030802.tar.bz2
bpo-40275: Use new test.support helper submodules in tests (GH-21315)
Diffstat (limited to 'Lib/test/test_linecache.py')
-rw-r--r--Lib/test/test_linecache.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_linecache.py b/Lib/test/test_linecache.py
index 375d9c4..cfc6ba8 100644
--- a/Lib/test/test_linecache.py
+++ b/Lib/test/test_linecache.py
@@ -6,6 +6,7 @@ import os.path
import tempfile
import tokenize
from test import support
+from test.support import os_helper
FILENAME = linecache.__file__
@@ -44,7 +45,7 @@ class TempFile:
with tempfile.NamedTemporaryFile(delete=False) as fp:
self.file_name = fp.name
fp.write(self.file_byte_string)
- self.addCleanup(support.unlink, self.file_name)
+ self.addCleanup(os_helper.unlink, self.file_name)
class GetLineTestsGoodData(TempFile):
@@ -124,10 +125,10 @@ class LineCacheTests(unittest.TestCase):
self.assertEqual(empty, [])
def test_no_ending_newline(self):
- self.addCleanup(support.unlink, support.TESTFN)
- with open(support.TESTFN, "w") as fp:
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ with open(os_helper.TESTFN, "w") as fp:
fp.write(SOURCE_3)
- lines = linecache.getlines(support.TESTFN)
+ lines = linecache.getlines(os_helper.TESTFN)
self.assertEqual(lines, ["\n", "def f():\n", " return 3\n"])
def test_clearcache(self):
@@ -150,8 +151,8 @@ class LineCacheTests(unittest.TestCase):
def test_checkcache(self):
getline = linecache.getline
# Create a source file and cache its contents
- source_name = support.TESTFN + '.py'
- self.addCleanup(support.unlink, source_name)
+ source_name = os_helper.TESTFN + '.py'
+ self.addCleanup(os_helper.unlink, source_name)
with open(source_name, 'w') as source:
source.write(SOURCE_1)
getline(source_name, 1)