<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> import zipfile <EOL> import unittest <EOL> from test . test_support import run_unittest <EOL> try : <EOL> import zlib <EOL> except ImportError : <EOL> zlib = None <EOL> from distutils . core import Distribution <EOL> from distutils . command . bdist_dumb import bdist_dumb <EOL> from distutils . tests import support <EOL> SETUP_PY = """<STR_LIT>""" <EOL> class BuildDumbTestCase ( support . TempdirManager , <EOL> support . LoggingSilencer , <EOL> support . EnvironGuard , <EOL> unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( BuildDumbTestCase , self ) . setUp ( ) <EOL> self . old_location = os . getcwd ( ) <EOL> self . old_sys_argv = sys . argv , sys . argv [ : ] <EOL> def tearDown ( self ) : <EOL> os . chdir ( self . old_location ) <EOL> sys . argv = self . old_sys_argv [ <NUM_LIT:0> ] <EOL> sys . argv [ : ] = self . old_sys_argv [ <NUM_LIT:1> ] <EOL> super ( BuildDumbTestCase , self ) . tearDown ( ) <EOL> @ unittest . skipUnless ( zlib , "<STR_LIT>" ) <EOL> def test_simple_built ( self ) : <EOL> tmp_dir = self . mkdtemp ( ) <EOL> pkg_dir = os . path . join ( tmp_dir , '<STR_LIT:foo>' ) <EOL> os . mkdir ( pkg_dir ) <EOL> self . write_file ( ( pkg_dir , '<STR_LIT>' ) , SETUP_PY ) <EOL> self . write_file ( ( pkg_dir , '<STR_LIT>' ) , '<STR_LIT:#>' ) <EOL> self . write_file ( ( pkg_dir , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . write_file ( ( pkg_dir , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> dist = Distribution ( { '<STR_LIT:name>' : '<STR_LIT:foo>' , '<STR_LIT:version>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT:foo>' ] , <EOL> '<STR_LIT:url>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> dist . script_name = '<STR_LIT>' <EOL> os . chdir ( pkg_dir ) <EOL> sys . argv = [ '<STR_LIT>' ] <EOL> cmd = bdist_dumb ( dist ) <EOL> cmd . format = '<STR_LIT>' <EOL> cmd . ensure_finalized ( ) <EOL> cmd . run ( ) <EOL> dist_created = os . listdir ( os . path . join ( pkg_dir , '<STR_LIT>' ) ) <EOL> base = "<STR_LIT>" % ( dist . get_fullname ( ) , cmd . plat_name ) <EOL> if os . name == '<STR_LIT>' : <EOL> base = base . replace ( '<STR_LIT::>' , '<STR_LIT:->' ) <EOL> self . assertEqual ( dist_created , [ base ] ) <EOL> fp = zipfile . ZipFile ( os . path . join ( '<STR_LIT>' , base ) ) <EOL> try : <EOL> contents = fp . namelist ( ) <EOL> finally : <EOL> fp . close ( ) <EOL> contents = sorted ( os . path . basename ( fn ) for fn in contents ) <EOL> wanted = [ '<STR_LIT>' % sys . version_info [ : <NUM_LIT:2> ] , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( contents , sorted ( wanted ) ) <EOL> def test_finalize_options ( self ) : <EOL> pkg_dir , dist = self . create_dist ( ) <EOL> os . chdir ( pkg_dir ) <EOL> cmd = bdist_dumb ( dist ) <EOL> self . assertEqual ( cmd . bdist_dir , None ) <EOL> cmd . finalize_options ( ) <EOL> base = cmd . get_finalized_command ( '<STR_LIT>' ) . bdist_base <EOL> self . assertEqual ( cmd . bdist_dir , os . path . join ( base , '<STR_LIT>' ) ) <EOL> default = cmd . default_format [ os . name ] <EOL> self . assertEqual ( cmd . format , default ) <EOL> def test_suite ( ) : <EOL> return unittest . makeSuite ( BuildDumbTestCase ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> run_unittest ( test_suite ( ) ) </s>
