@importorskip('PIL')
@importorskip(modname_tkinter)
@xfail(is_darwin, reason='Issue #1895. Known to fail with macpython - python.org binary.')
def test_pil_tkinter(pyi_builder):
 pyi_builder.test_source('\n        import PIL.Image\n\n        # Statically importing the Tkinter package should succeed, implying this\n        # importation successfully overrode the exclusion of this package\n        # requested by "PIL" package hooks. To ensure PyInstaller parses this\n        # import and freezes this package with this test, this import is static.\n        try:\n            import {modname_tkinter}\n        except ImportError:\n            raise SystemExit(\'ERROR: Module {modname_tkinter} is NOT bundled.\')\n        '.format(modname_tkinter=modname_tkinter))

@ importorskip ( 'PIL' ) @ importorskip ( modname_tkinter ) @ xfail ( is_darwin , reason = 'Issue #1895. Known to fail with macpython - python.org binary.' ) def test_pil_tkinter ( pyi_builder ) : pyi_builder . test_source ( '\n        import PIL.Image\n\n        # Statically importing the Tkinter package should succeed, implying this\n        # importation successfully overrode the exclusion of this package\n        # requested by "PIL" package hooks. To ensure PyInstaller parses this\n        # import and freezes this package with this test, this import is static.\n        try:\n            import {modname_tkinter}\n        except ImportError:\n            raise SystemExit(\'ERROR: Module {modname_tkinter} is NOT bundled.\')\n        ' . format ( modname_tkinter = modname_tkinter ) )
ensure that the tkinter package excluded by pil package hooks is importable by frozen applications explicitly importing both .