bpo-31904: Fix test_netrc for VxWorks RTOS (GH-21675)
Fix test_netrc on VxWorks: create temporary directories using temp_cwd().
This commit is contained in:
parent
1867b462de
commit
e483d281bd
|
@ -109,9 +109,7 @@ 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 = os_helper.TESTFN
|
||||
os.mkdir(d)
|
||||
self.addCleanup(os_helper.rmtree, d)
|
||||
with os_helper.temp_cwd(None) as d:
|
||||
fn = os.path.join(d, '.netrc')
|
||||
with open(fn, 'wt') as f:
|
||||
f.write("""\
|
||||
|
@ -128,9 +126,7 @@ class NetrcTestCase(unittest.TestCase):
|
|||
self.assertRaises(netrc.NetrcParseError, netrc.netrc)
|
||||
|
||||
def test_file_not_found_in_home(self):
|
||||
d = os_helper.TESTFN
|
||||
os.mkdir(d)
|
||||
self.addCleanup(os_helper.rmtree, d)
|
||||
with os_helper.temp_cwd(None) as d:
|
||||
with os_helper.EnvironmentVarGuard() as environ:
|
||||
environ.set('HOME', d)
|
||||
self.assertRaises(FileNotFoundError, netrc.netrc)
|
||||
|
@ -140,9 +136,7 @@ class NetrcTestCase(unittest.TestCase):
|
|||
file='unlikely_netrc')
|
||||
|
||||
def test_home_not_set(self):
|
||||
fake_home = os_helper.TESTFN
|
||||
os.mkdir(fake_home)
|
||||
self.addCleanup(os_helper.rmtree, fake_home)
|
||||
with os_helper.temp_cwd(None) as 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')
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix test_netrc on VxWorks: create temporary directories using temp_cwd().
|
Loading…
Reference in New Issue