sanitycheck tests for the freeze tool import sys import textwrap import unittest from test import support from test support import oshelper from test testtools import importsundertool skipifmissing skipifmissing freeze with importsundertool freeze test import freeze as helper support requireszlib unittest skipifsys platform startswith win not supported on windows support skipifbuildbot not all buildbots have enough space gh103053 skip test if python is built with profile guided optimization pgo since the test is just too slow in this case unittest skipifsupport checkcflagspgo test is too slow with pgo class testfreezeunittest testcase support requiresresource cpu building python is slow def testfreezesimplescriptself script textwrap dedent import sys print running sys exit0 gh 103053 skip test if python is built with profile guided optimization pgo since the test is just too slow in this case building python is slow import sys print running sys exit 0
import sys
import textwrap
import unittest

from test import support
from test.support import os_helper
from test.test_tools import imports_under_tool, skip_if_missing

skip_if_missing('freeze')
with imports_under_tool('freeze', 'test'):
    import freeze as helper

@support.requires_zlib()
@unittest.skipIf(sys.platform.startswith('win'), 'not supported on Windows')
@support.skip_if_buildbot('not all buildbots have enough space')


@unittest.skipIf(support.check_cflags_pgo(),
                 'test is too slow with PGO')
class TestFreeze(unittest.TestCase):

    @support.requires_resource('cpu') 
    def test_freeze_simple_script(self):
        script = textwrap.dedent()
        with os_helper.temp_dir() as outdir:
            outdir, scriptfile, python = helper.prepare(script, outdir)
            executable = helper.freeze(python, scriptfile, outdir)
            text = helper.run(executable)
        self.assertEqual(text, 'running...')