commit/galaxy-central: greg: Fix tool shed unit test I broke with a recent commit.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/73658f181e30/ Changeset: 73658f181e30 User: greg Date: 2013-12-03 21:52:46 Summary: Fix tool shed unit test I broke with a recent commit. Affected #: 2 files diff -r 41e739778945ac5f564785b59b2a90051676d4f2 -r 73658f181e3064c0220d7538432a14caa72aeebb lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -41,8 +41,9 @@ return_code = file_append( env_entry, env_file, skip_if_contained=skip_if_contained, make_executable=make_executable ) self.return_code = self.return_code or return_code return self.return_code - - def create_or_update_env_shell_file( self, install_dir, env_var_dict ): + + @staticmethod + def create_or_update_env_shell_file( install_dir, env_var_dict ): env_var_action = env_var_dict[ 'action' ] env_var_value = env_var_dict[ 'value' ] if env_var_action in [ 'prepend_to', 'set_to', 'append_to' ]: @@ -417,7 +418,8 @@ return tool_dependency # R libraries are installed to $INSTALL_DIR (install_dir), we now set the R_LIBS path to that directory env_file_builder = EnvFileBuilder( install_dir ) - handle_action_shell_file_paths( env_file_builder, action_dict ) # Pull in R environment (runtime). + # Pull in R environment (runtime). + handle_action_shell_file_paths( env_file_builder, action_dict ) env_file_builder.append_line( name="R_LIBS", action="prepend_to", value=install_dir ) return_code = env_file_builder.return_code if return_code: diff -r 41e739778945ac5f564785b59b2a90051676d4f2 -r 73658f181e3064c0220d7538432a14caa72aeebb test/unit/tool_shed/test_td_common_util.py --- a/test/unit/tool_shed/test_td_common_util.py +++ b/test/unit/tool_shed/test_td_common_util.py @@ -2,6 +2,7 @@ from contextlib import contextmanager from galaxy.util import parse_xml_string +from tool_shed.galaxy_install.tool_dependencies import fabric_util from tool_shed.galaxy_install.tool_dependencies import td_common_util @@ -14,26 +15,26 @@ def __init__( self ): pass - -def test_create_or_update_env_shell_file( ): +def test_create_or_update_env_shell_file(): test_path = "/usr/share/R/libs" - line, path = td_common_util.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict(action="append_to", name="R_LIBS", value=test_path)) + env_file_builder = fabric_util.EnvFileBuilder( test_path ) + line, path = env_file_builder.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict( action="append_to", name="R_LIBS", value=test_path ) ) assert path == join( TEST_INSTALL_DIR, "env.sh" ) assert line == "R_LIBS=$R_LIBS:/usr/share/R/libs; export R_LIBS" - line, path = td_common_util.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict(action="prepend_to", name="R_LIBS", value=test_path)) + line, path = env_file_builder.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict( action="prepend_to", name="R_LIBS", value=test_path ) ) assert path == join( TEST_INSTALL_DIR, "env.sh" ) assert line == "R_LIBS=/usr/share/R/libs:$R_LIBS; export R_LIBS" - line, path = td_common_util.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict(action="set_to", name="R_LIBS", value=test_path)) + line, path = env_file_builder.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict( action="set_to", name="R_LIBS", value=test_path ) ) assert path == join( TEST_INSTALL_DIR, "env.sh" ) assert line == "R_LIBS=/usr/share/R/libs; export R_LIBS" - line, path = td_common_util.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict(action="source", value=test_path)) + line, path = env_file_builder.create_or_update_env_shell_file( TEST_INSTALL_DIR, dict( action="source", value=test_path ) ) assert path == join( TEST_INSTALL_DIR, "env.sh" ) assert line == ". /usr/share/R/libs" -def test_get_env_shell_file_paths_from_setup_environment_elem( ): +def test_get_env_shell_file_paths_from_setup_environment_elem(): xml = """<action name="setup_r_environment"><repository name="package_r_3_0_1" owner="bgruening" toolshed="toolshed.g2.bx.psu.edu" changeset_revision="1234567"><package name="R" version="3.0.1" /> @@ -70,10 +71,10 @@ ## Poor man's mocking. Need to get a real mocking library as real Galaxy development ## dependnecy. @contextmanager -def __mock_common_util_method(name, mock_method): - real_method = getattr(td_common_util, name) +def __mock_common_util_method( name, mock_method ): + real_method = getattr( td_common_util, name ) try: - setattr(td_common_util, name, mock_method) + setattr( td_common_util, name, mock_method ) yield finally: - setattr(td_common_util, name, real_method) + setattr( td_common_util, name, real_method ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org