<s> """<STR_LIT>""" <EOL> import unittest <EOL> import sys <EOL> import os <EOL> import tempfile <EOL> import shutil <EOL> from test . test_support import run_unittest <EOL> from distutils . core import Distribution <EOL> from distutils . command . bdist_rpm import bdist_rpm <EOL> from distutils . tests import support <EOL> from distutils . spawn import find_executable <EOL> from distutils import spawn <EOL> from distutils . errors import DistutilsExecError <EOL> SETUP_PY = """<STR_LIT>""" <EOL> class BuildRpmTestCase ( support . TempdirManager , <EOL> support . EnvironGuard , <EOL> support . LoggingSilencer , <EOL> unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( BuildRpmTestCase , 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 ( BuildRpmTestCase , self ) . tearDown ( ) <EOL> @ unittest . skipUnless ( sys . platform . startswith ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' ) <EOL> @ unittest . skipIf ( find_executable ( '<STR_LIT>' ) is None , <EOL> '<STR_LIT>' ) <EOL> @ unittest . skipIf ( find_executable ( '<STR_LIT>' ) is None , <EOL> '<STR_LIT>' ) <EOL> def test_quiet ( self ) : <EOL> tmp_dir = self . mkdtemp ( ) <EOL> os . environ [ '<STR_LIT>' ] = tmp_dir <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_rpm ( dist ) <EOL> cmd . fix_python = True <EOL> cmd . quiet = <NUM_LIT:1> <EOL> cmd . ensure_finalized ( ) <EOL> cmd . run ( ) <EOL> dist_created = os . listdir ( os . path . join ( pkg_dir , '<STR_LIT>' ) ) <EOL> self . assertIn ( '<STR_LIT>' , dist_created ) <EOL> self . assertIn ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , dist . dist_files ) <EOL> self . assertIn ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , dist . dist_files ) <EOL> @ unittest . skipUnless ( sys . platform . startswith ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' ) <EOL> @ unittest . skipIf ( find_executable ( '<STR_LIT>' ) is None , <EOL> '<STR_LIT>' ) <EOL> @ unittest . skipIf ( find_executable ( '<STR_LIT>' ) is None , <EOL> '<STR_LIT>' ) <EOL> def test_no_optimize_flag ( self ) : <EOL> tmp_dir = self . mkdtemp ( ) <EOL> os . environ [ '<STR_LIT>' ] = tmp_dir <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_rpm ( dist ) <EOL> cmd . fix_python = True <EOL> cmd . quiet = <NUM_LIT:1> <EOL> cmd . ensure_finalized ( ) <EOL> cmd . run ( ) <EOL> dist_created = os . listdir ( os . path . join ( pkg_dir , '<STR_LIT>' ) ) <EOL> self . assertIn ( '<STR_LIT>' , dist_created ) <EOL> self . assertIn ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , dist . dist_files ) <EOL> self . assertIn ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , dist . dist_files ) <EOL> os . remove ( os . path . join ( pkg_dir , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_suite ( ) : <EOL> return unittest . makeSuite ( BuildRpmTestCase ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> run_unittest ( test_suite ( ) ) </s>
