(self)
| 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 | |
| 46 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected