mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Skip estLoadWithUNC when UNC is not available.
This commit is contained in:
parent
b3b390d7b3
commit
dda7fdf194
1 changed files with 5 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
from test import support
|
from test import support
|
||||||
|
|
||||||
|
@ -127,21 +128,20 @@ class TclTest(unittest.TestCase):
|
||||||
tcl = self.interp
|
tcl = self.interp
|
||||||
self.assertRaises(TclError,tcl.eval,'package require DNE')
|
self.assertRaises(TclError,tcl.eval,'package require DNE')
|
||||||
|
|
||||||
|
@unittest.skipUnless(sys.platform == 'win32', 'Requires Windows')
|
||||||
def testLoadWithUNC(self):
|
def testLoadWithUNC(self):
|
||||||
import sys
|
|
||||||
if sys.platform != 'win32':
|
|
||||||
return
|
|
||||||
|
|
||||||
# Build a UNC path from the regular path.
|
# Build a UNC path from the regular path.
|
||||||
# Something like
|
# Something like
|
||||||
# \\%COMPUTERNAME%\c$\python27\python.exe
|
# \\%COMPUTERNAME%\c$\python27\python.exe
|
||||||
|
|
||||||
fullname = os.path.abspath(sys.executable)
|
fullname = os.path.abspath(sys.executable)
|
||||||
if fullname[1] != ':':
|
if fullname[1] != ':':
|
||||||
return
|
raise unittest.SkipTest('Absolute path should have drive part')
|
||||||
unc_name = r'\\%s\%s$\%s' % (os.environ['COMPUTERNAME'],
|
unc_name = r'\\%s\%s$\%s' % (os.environ['COMPUTERNAME'],
|
||||||
fullname[0],
|
fullname[0],
|
||||||
fullname[3:])
|
fullname[3:])
|
||||||
|
if not os.path.exists(unc_name):
|
||||||
|
raise unittest.SkipTest('Cannot connect to UNC Path')
|
||||||
|
|
||||||
with support.EnvironmentVarGuard() as env:
|
with support.EnvironmentVarGuard() as env:
|
||||||
env.unset("TCL_LIBRARY")
|
env.unset("TCL_LIBRARY")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue