diff options
Diffstat (limited to 'Lib/test/test_netrc.py')
-rw-r--r-- | Lib/test/test_netrc.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py index 7ce7e56..2bd46aa 100644 --- a/Lib/test/test_netrc.py +++ b/Lib/test/test_netrc.py @@ -1,5 +1,6 @@ import netrc, os, unittest, sys, tempfile, textwrap from test import support +from test.support import os_helper class NetrcTestCase(unittest.TestCase): @@ -108,16 +109,16 @@ class NetrcTestCase(unittest.TestCase): def test_security(self): # This test is incomplete since we are normally not run as root and # therefore can't test the file ownership being wrong. - d = support.TESTFN + d = os_helper.TESTFN os.mkdir(d) - self.addCleanup(support.rmtree, d) + self.addCleanup(os_helper.rmtree, d) fn = os.path.join(d, '.netrc') with open(fn, 'wt') as f: f.write("""\ machine foo.domain.com login bar password pass default login foo password pass """) - with support.EnvironmentVarGuard() as environ: + with os_helper.EnvironmentVarGuard() as environ: environ.set('HOME', d) os.chmod(fn, 0o600) nrc = netrc.netrc() @@ -127,10 +128,10 @@ class NetrcTestCase(unittest.TestCase): self.assertRaises(netrc.NetrcParseError, netrc.netrc) def test_file_not_found_in_home(self): - d = support.TESTFN + d = os_helper.TESTFN os.mkdir(d) - self.addCleanup(support.rmtree, d) - with support.EnvironmentVarGuard() as environ: + self.addCleanup(os_helper.rmtree, d) + with os_helper.EnvironmentVarGuard() as environ: environ.set('HOME', d) self.assertRaises(FileNotFoundError, netrc.netrc) @@ -139,9 +140,9 @@ class NetrcTestCase(unittest.TestCase): file='unlikely_netrc') def test_home_not_set(self): - fake_home = support.TESTFN + fake_home = os_helper.TESTFN os.mkdir(fake_home) - self.addCleanup(support.rmtree, fake_home) + self.addCleanup(os_helper.rmtree, fake_home) fake_netrc_path = os.path.join(fake_home, '.netrc') with open(fake_netrc_path, 'w') as f: f.write('machine foo.domain.com login bar password pass') @@ -152,7 +153,7 @@ class NetrcTestCase(unittest.TestCase): def fake_expanduser(s): called.append(s) - with support.EnvironmentVarGuard() as environ: + with os_helper.EnvironmentVarGuard() as environ: environ.set('HOME', fake_home) environ.set('USERPROFILE', fake_home) result = orig_expanduser(s) |