MCPcopy Index your code
hub / github.com/python/cpython / testLoadTkFailure

Method testLoadTkFailure

Lib/test/test_tkinter/test_loadtk.py:21–43  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

19 tcl.destroy()
20
21 def testLoadTkFailure(self):
22 old_display = None
23 if sys.platform.startswith(('win', 'darwin', 'cygwin')):
24 # no failure possible on windows?
25
26 # XXX Maybe on tk older than 8.4.13 it would be possible,
27 # see tkinter.h.
28 return
29 with os_helper.EnvironmentVarGuard() as env:
30 if 'DISPLAY' in os.environ:
31 del env['DISPLAY']
32 # on some platforms, deleting environment variables
33 # doesn't actually carry through to the process level
34 # because they don't support unsetenv
35 # If that's the case, abort.
36 with os.popen('echo $DISPLAY') as pipe:
37 display = pipe.read().strip()
38 if display:
39 return
40
41 tcl = Tcl()
42 self.assertRaises(TclError, tcl.winfo_geometry)
43 self.assertRaises(TclError, tcl.loadtk)
44
45
46if __name__ == "__main__":

Callers

nothing calls this directly

Calls 5

TclFunction · 0.90
startswithMethod · 0.45
stripMethod · 0.45
readMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected