<s> try : <EOL> TYPE_FILE = file <EOL> except NameError : <EOL> from io import FileIO <EOL> TYPE_FILE = FileIO <EOL> import unittest <EOL> from test_utils import patch , MagicMock , ANY <EOL> from pybuilder . core import Project , Author , Logger <EOL> from pybuilder . errors import BuildFailedException <EOL> from pybuilder . pip_utils import PIP_EXEC_STANZA <EOL> from pybuilder . plugins . python . distutils_plugin import ( build_data_files_string , <EOL> build_dependency_links_string , <EOL> build_install_dependencies_string , <EOL> build_package_data_string , <EOL> build_entry_points_string , <EOL> default , <EOL> render_manifest_file , <EOL> build_scripts_string , <EOL> render_setup_script , <EOL> initialize_distutils_plugin , <EOL> execute_distutils , <EOL> upload , <EOL> install_distribution , <EOL> build_binary_distribution , <EOL> _normalize_setup_post_pre_script , <EOL> build_string_from_array , <EOL> _run_process_and_wait , <EOL> ) <EOL> from test_utils import PyBuilderTestCase <EOL> class InstallDependenciesTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . project = Project ( "<STR_LIT:.>" ) <EOL> def test_should_leave_user_specified_properties_when_initializing_plugin ( self ) : <EOL> expected_properties = { <EOL> "<STR_LIT>" : [ "<STR_LIT:foo>" , "<STR_LIT:bar>" ] , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT>" : [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] , <EOL> "<STR_LIT>" : False <EOL> } <EOL> for property_name , property_value in expected_properties . items ( ) : <EOL> self . project . set_property ( property_name , property_value ) <EOL> initialize_distutils_plugin ( self . project ) <EOL> for property_name , property_value in expected_properties . items ( ) : <EOL> self . assertEquals ( <EOL> self . project . get_property ( "<STR_LIT>" ) , [ "<STR_LIT:foo>" , "<STR_LIT:bar>" ] ) <EOL> self . assertEquals ( <EOL> self . project . get_property ( "<STR_LIT>" ) , True ) <EOL> self . assertEquals ( <EOL> self . project . get_property ( "<STR_LIT>" ) , [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> self . assertEquals ( <EOL> self . project . get_property ( "<STR_LIT>" ) , False ) <EOL> def test_should_return_empty_string_when_no_dependency_is_given ( self ) : <EOL> self . assertEqual ( "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> def test_should_return_single_dependency_string ( self ) : <EOL> self . project . depends_on ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> def test_should_return_single_dependency_string_with_version ( self ) : <EOL> self . project . depends_on ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> def test_should_return_multiple_dependencies_string_with_versions ( self ) : <EOL> self . project . depends_on ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . depends_on ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , <EOL> build_install_dependencies_string ( self . project ) ) <EOL> def test_should_not_insert_url_dependency_into_install_requires ( self ) : <EOL> self . project . depends_on ( "<STR_LIT>" ) <EOL> self . project . depends_on ( <EOL> "<STR_LIT>" , url = "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> def test_should_not_insert_default_version_operator_when_project_contains_operator_in_version ( self ) : <EOL> self . project . depends_on ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_quote_requirements ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ "<STR_LIT:foo>" , "<STR_LIT:bar>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_ignore_empty_requirement_lines ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ "<STR_LIT>" , "<STR_LIT:foo>" , "<STR_LIT:bar>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_ignore_comments_from_requirements ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ "<STR_LIT>" , "<STR_LIT:bar>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_ignore_comments_with_leading_space_from_requirements ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ "<STR_LIT>" , "<STR_LIT:bar>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_ignore_editable_urls_from_requirements ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ <EOL> "<STR_LIT:foo>" , "<STR_LIT>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_ignore_expanded_editable_urls_from_requirements ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ <EOL> "<STR_LIT:foo>" , "<STR_LIT>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , build_install_dependencies_string ( self . project ) ) <EOL> class DependencyLinksTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . project = Project ( "<STR_LIT:.>" ) <EOL> def test_should_return_empty_string_when_no_link_dependency_is_given ( self ) : <EOL> self . assertEqual ( "<STR_LIT>" , build_dependency_links_string ( self . project ) ) <EOL> def test_should_return_dependency_link ( self ) : <EOL> self . project . depends_on ( <EOL> "<STR_LIT>" , url = "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , <EOL> build_dependency_links_string ( self . project ) ) <EOL> def test_should_return_dependency_links ( self ) : <EOL> self . project . depends_on ( "<STR_LIT>" , <EOL> url = "<STR_LIT>" ) <EOL> self . project . depends_on ( "<STR_LIT>" , <EOL> url = "<STR_LIT>" ) <EOL> self . assertEqual ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> build_dependency_links_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_use_editable_urls_from_requirements_as_dependency_links ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> build_dependency_links_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_use_expanded_editable_urls_from_requirements_as_dependency_links ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> build_dependency_links_string ( self . project ) ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_use_editable_urls_from_requirements_combined_with_url_dependencies ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ <EOL> "<STR_LIT>" ] <EOL> self . project . depends_on ( <EOL> "<STR_LIT>" , url = "<STR_LIT>" ) <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> build_dependency_links_string ( self . project ) ) <EOL> class DefaultTest ( unittest . TestCase ) : <EOL> def test_should_return_empty_string_as_default_when_given_value_is_none ( self ) : <EOL> self . assertEqual ( "<STR_LIT>" , default ( None ) ) <EOL> def test_should_return_given_default_when_given_value_is_none ( self ) : <EOL> self . assertEqual ( "<STR_LIT:default>" , default ( None , default = "<STR_LIT:default>" ) ) <EOL> def test_should_return_value_string_when_value_given ( self ) : <EOL> self . assertEqual ( "<STR_LIT:value>" , default ( "<STR_LIT:value>" ) ) <EOL> def test_should_return_value_string_when_value_and_default_given ( self ) : <EOL> self . assertEqual ( "<STR_LIT:value>" , default ( "<STR_LIT:value>" , default = "<STR_LIT:default>" ) ) <EOL> class BuildDataFilesStringTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . project = Project ( "<STR_LIT:.>" ) <EOL> def test_should_return_empty_data_files_string ( self ) : <EOL> self . assertEqual ( "<STR_LIT>" , build_data_files_string ( self . project ) ) <EOL> def test_should_return_data_files_string_including_several_files ( self ) : <EOL> self . project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , <EOL> build_data_files_string ( self . project ) ) <EOL> def test_should_return_data_files_string_with_files_to_be_installed_in_several_destinations ( self ) : <EOL> self . project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . install_file ( "<STR_LIT:data>" , "<STR_LIT>" ) <EOL> self . project . install_file ( "<STR_LIT:data>" , "<STR_LIT>" ) <EOL> self . assertEqual ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> build_data_files_string ( self . project ) ) <EOL> class BuildPackageDataStringTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . project = Project ( '<STR_LIT:.>' ) <EOL> def test_should_return_empty_package_data_string_when_no_files_to_include_given ( self ) : <EOL> self . assertEqual ( '<STR_LIT:{}>' , build_package_data_string ( self . project ) ) <EOL> def test_should_return_package_data_string_when_including_file ( self ) : <EOL> self . project . include_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , build_package_data_string ( self . project ) ) <EOL> def test_should_return_package_data_string_when_including_three_files ( self ) : <EOL> self . project . include_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , build_package_data_string ( self . project ) ) <EOL> def test_should_return_package_data_string_with_keys_in_alphabetical_order ( self ) : <EOL> self . project . include_file ( "<STR_LIT:b>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:m>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:e>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:k>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:p>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:z>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:i>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:a>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:d>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:t>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:l>" , "<STR_LIT>" ) <EOL> self . project . include_file ( "<STR_LIT:x>" , "<STR_LIT>" ) <EOL> self . assertEqual ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , build_package_data_string ( self . project ) ) <EOL> class RenderSetupScriptTest ( PyBuilderTestCase ) : <EOL> def setUp ( self ) : <EOL> self . project = create_project ( ) <EOL> def test_should_remove_hardlink_capabilities_when_workaround_is_enabled ( self ) : <EOL> self . project . set_property ( <EOL> "<STR_LIT>" , True ) <EOL> actual_setup_script = render_setup_script ( self . project ) <EOL> self . assertTrue ( "<STR_LIT>" in actual_setup_script ) <EOL> def test_should_not_remove_hardlink_capabilities_when_workaround_is_disabled ( self ) : <EOL> self . project . set_property ( <EOL> "<STR_LIT>" , False ) <EOL> actual_setup_script = render_setup_script ( self . project ) <EOL> self . assertFalse ( "<STR_LIT>" in actual_setup_script ) <EOL> def test_should_render_build_scripts_properly_when_dir_scripts_is_provided ( self ) : <EOL> self . project . set_property ( "<STR_LIT>" , '<STR_LIT>' ) <EOL> actual_build_script = build_scripts_string ( self . project ) <EOL> self . assertEquals ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , actual_build_script ) <EOL> def test_should_render_setup_file ( self ) : <EOL> actual_setup_script = render_setup_script ( self . project ) <EOL> self . assert_line_by_line_equal ( """<STR_LIT>""" , actual_setup_script ) <EOL> def test_should_render_setup_file_install_script_wrappers ( self ) : <EOL> self . project . pre_install_script ( "<STR_LIT>" ) <EOL> self . project . post_install_script ( "<STR_LIT>" ) <EOL> actual_setup_script = render_setup_script ( self . project ) <EOL> self . assert_line_by_line_equal ( """<STR_LIT>""" , actual_setup_script ) <EOL> def test_should_render_console_scripts_when_property_is_set ( self ) : <EOL> self . project . set_property ( "<STR_LIT>" , [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> actual_setup_script = build_entry_points_string ( self . project ) <EOL> self . assertEquals ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , actual_setup_script ) <EOL> def test_should_render_console_script_when_property_is_set ( self ) : <EOL> self . project . set_property ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> actual_setup_script = build_entry_points_string ( self . project ) <EOL> self . assertEquals ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , actual_setup_script ) <EOL> def test_should_render_entry_points_when_property_is_set ( self ) : <EOL> self . project . set_property ( "<STR_LIT>" , { '<STR_LIT>' : [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] , <EOL> '<STR_LIT>' : [ "<STR_LIT>" ] <EOL> } ) <EOL> actual_setup_script = build_entry_points_string ( self . project ) <EOL> self . assertEquals ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , actual_setup_script ) <EOL> def test_should_fail_with_entry_points_and_console_scripts_set ( self ) : <EOL> self . project . set_property ( "<STR_LIT>" , object ( ) ) <EOL> self . project . set_property ( "<STR_LIT>" , object ( ) ) <EOL> self . assertRaises ( BuildFailedException , build_entry_points_string , self . project ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> def test_should_render_runtime_dependencies_when_requirements_file_used ( self , mock_open ) : <EOL> mock_open . return_value = MagicMock ( spec = TYPE_FILE ) <EOL> handle = mock_open . return_value . __enter__ . return_value <EOL> handle . readlines . return_value = [ "<STR_LIT>" , "<STR_LIT:foo>" , "<STR_LIT:bar>" ] <EOL> self . project . depends_on_requirements ( "<STR_LIT>" ) <EOL> actual_setup_script = build_install_dependencies_string ( self . project ) <EOL> self . assertEquals ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , actual_setup_script ) <EOL> def test_normalize_setup_post_pre_script ( self ) : <EOL> test_script = '''<STR_LIT>''' <EOL> expected_script = '''<STR_LIT>''' <EOL> self . assert_line_by_line_equal ( expected_script , _normalize_setup_post_pre_script ( test_script ) ) <EOL> class UtilityMethodTest ( PyBuilderTestCase ) : <EOL> def test_build_string_from_array_empty ( self ) : <EOL> self . assert_line_by_line_equal ( '<STR_LIT>' , build_string_from_array ( [ ] ) ) <EOL> def test_build_string_from_array_simple ( self ) : <EOL> self . assert_line_by_line_equal ( "<STR_LIT>" , build_string_from_array ( [ '<STR_LIT:a>' ] ) ) <EOL> def test_build_string_from_array_of_array_of_empty ( self ) : <EOL> self . assert_line_by_line_equal ( '''<STR_LIT>''' , build_string_from_array ( [ [ ] ] ) ) <EOL> def test_build_string_from_array_of_array_single_element ( self ) : <EOL> self . assert_line_by_line_equal ( '''<STR_LIT>''' , build_string_from_array ( [ [ '<STR_LIT:a>' ] ] ) ) <EOL> def test_build_string_from_array_of_array_multiple_elements ( self ) : <EOL> self . assert_line_by_line_equal ( '''<STR_LIT>''' , build_string_from_array ( [ [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ] ) ) <EOL> def test_build_string_from_array_of_arrays_single_element ( self ) : <EOL> self . assert_line_by_line_equal ( '''<STR_LIT>''' , build_string_from_array ( [ [ '<STR_LIT:a>' ] , [ '<STR_LIT:b>' ] ] ) ) <EOL> def test_build_string_from_array_of_arrays_multiple_elements ( self ) : <EOL> self . assert_line_by_line_equal ( '''<STR_LIT>''' , build_string_from_array ( [ [ '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' ] ] ) ) <EOL> class RenderManifestFileTest ( unittest . TestCase ) : <EOL> def test_should_render_manifest_file ( self ) : <EOL> project = create_project ( ) <EOL> actual_manifest_file = render_manifest_file ( project ) <EOL> self . assertEqual ( """<STR_LIT>""" , actual_manifest_file ) <EOL> class ExecuteDistUtilsTest ( PyBuilderTestCase ) : <EOL> def setUp ( self ) : <EOL> self . project = create_project ( ) <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_should_accept_array_of_simple_commands ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> commands = [ "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" ] <EOL> execute_distutils ( self . project , MagicMock ( Logger ) , commands ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:3> , proc_runner ) , [ [ cmd ] for cmd in commands ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_should_accept_array_of_compound_commands ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> commands = [ "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" ] <EOL> execute_distutils ( self . project , MagicMock ( Logger ) , [ commands ] ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:1> , proc_runner ) , [ commands ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test__run_process_and_wait ( self , popen ) : <EOL> commands = [ "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" ] <EOL> _run_process_and_wait ( commands , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> popen . assert_called_with ( commands , cwd = "<STR_LIT>" , stdout = "<STR_LIT>" , stderr = "<STR_LIT>" , shell = False ) <EOL> class TasksTest ( PyBuilderTestCase ) : <EOL> def setUp ( self ) : <EOL> self . project = create_project ( ) <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . set_property ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_upload ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> upload ( self . project , MagicMock ( Logger ) ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:2> , proc_runner ) , <EOL> [ [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_upload_with_command_options ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> self . project . set_property ( "<STR_LIT>" , { "<STR_LIT>" : '<STR_LIT>' } ) <EOL> upload ( self . project , MagicMock ( Logger ) ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:2> , proc_runner ) , <EOL> [ [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_upload_with_repo ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> upload ( self . project , MagicMock ( Logger ) ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:2> , proc_runner ) , <EOL> [ [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_upload_with_signature ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> self . project . set_property ( "<STR_LIT>" , True ) <EOL> upload ( self . project , MagicMock ( Logger ) ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:2> , proc_runner ) , <EOL> [ [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_upload_with_signature_and_identity ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> self . project . set_property ( "<STR_LIT>" , True ) <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> upload ( self . project , MagicMock ( Logger ) ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:2> , proc_runner ) , <EOL> [ [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_install ( self , execute_command , * args ) : <EOL> install_distribution ( self . project , MagicMock ( Logger ) ) <EOL> execute_command . assert_called_with ( PIP_EXEC_STANZA + [ "<STR_LIT>" , "<STR_LIT>" , '<STR_LIT>' ] , <EOL> cwd = "<STR_LIT:.>" , env = ANY , <EOL> outfile_name = ANY , error_file_name = ANY , shell = False ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_install_with_index_url ( self , execute_command , * args ) : <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> install_distribution ( self . project , MagicMock ( Logger ) ) <EOL> execute_command . assert_called_with ( <EOL> PIP_EXEC_STANZA + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , '<STR_LIT>' ] , cwd = "<STR_LIT:.>" , env = ANY , outfile_name = ANY , <EOL> error_file_name = ANY , shell = False ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_binary_distribution ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> build_binary_distribution ( self . project , MagicMock ( Logger ) ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:2> , proc_runner ) , <EOL> [ [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> @ patch ( "<STR_LIT>" , create = True ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_binary_distribution_with_command_options ( self , proc_runner , * args ) : <EOL> proc_runner . return_value = <NUM_LIT:0> <EOL> self . project . set_property ( "<STR_LIT>" , { "<STR_LIT>" : [ '<STR_LIT>' , '<STR_LIT>' ] } ) <EOL> build_binary_distribution ( self . project , MagicMock ( Logger ) ) <EOL> self . assertEquals ( popen_distutils_args ( self , <NUM_LIT:2> , proc_runner ) , <EOL> [ [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ] ) <EOL> def popen_distutils_args ( self , call_count , proc_runner ) : <EOL> self . assertEquals ( proc_runner . call_count , call_count ) <EOL> return [ call_args [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] [ <NUM_LIT:2> : ] for call_args in proc_runner . call_args_list ] <EOL> def create_project ( ) : <EOL> project = Project ( "<STR_LIT:/>" ) <EOL> project . build_depends_on ( "<STR_LIT>" ) <EOL> project . depends_on ( "<STR_LIT>" ) <EOL> project . depends_on ( <EOL> "<STR_LIT>" , url = "<STR_LIT>" ) <EOL> project . name = "<STR_LIT>" <EOL> project . version = "<STR_LIT>" <EOL> project . summary = "<STR_LIT>" <EOL> project . description = "<STR_LIT>" <EOL> project . authors = [ <EOL> Author ( "<STR_LIT>" , "<STR_LIT>" ) , Author ( "<STR_LIT>" , "<STR_LIT>" ) ] <EOL> project . license = "<STR_LIT>" <EOL> project . url = "<STR_LIT>" <EOL> def return_dummy_list ( ) : <EOL> return [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> project . list_scripts = return_dummy_list <EOL> project . list_packages = return_dummy_list <EOL> project . list_modules = return_dummy_list <EOL> project . set_property ( "<STR_LIT>" , [ <EOL> "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> project . install_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> project . include_file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> return project </s>
