def test__from_legacy_locations_non_existing_path(self): # When/Then with mock.patch( "enstaller.config.legacy_configuration_read_search_order", return_value=[self.prefix]): with self.assertRaises(InvalidConfiguration): Configuration._from_legacy_locations()
def test__from_legacy_locations_simple(self): # Given default_config_file = os.path.join(self.prefix, ".enstaller4rc") with open(default_config_file, "w") as fp: fp.write("store_url = \"http://acme.com\"") # When with mock.patch("enstaller.config.legacy_configuration_read_search_order", return_value=[self.prefix]): config = Configuration._from_legacy_locations() # Then self.assertEqual(config.store_url, "http://acme.com")
def test__from_legacy_locations_simple(self): # Given default_config_file = os.path.join(self.prefix, ".enstaller4rc") with open(default_config_file, "w") as fp: fp.write("store_url = \"http://acme.com\"") # When with mock.patch( "enstaller.config.legacy_configuration_read_search_order", return_value=[self.prefix]): config = Configuration._from_legacy_locations() # Then self.assertEqual(config.store_url, "http://acme.com")
def main(argv=None): argv = argv or sys.argv[1:] plat = enstaller.plat.custom_plat p = argparse.ArgumentParser() p.add_argument("requirement", help="Requirement string (e.g. 'mayavi')") p.add_argument("--platform", help="Platform to consider (default: %(default)s). 'all' works as well", default=plat) p.add_argument("--auth", help="Authentication (default: enpkg credentials)") namespace = p.parse_args(argv) config = Configuration._from_legacy_locations() config._platform = namespace.platform if namespace.auth is None: auth = config.auth else: auth = tuple(namespace.auth.split(":")) session = Session.from_configuration(config) with session: session.authenticate(auth) if namespace.platform == "all": platforms = ["rh5-32", "rh5-64", "osx-32", "osx-64", "win-32", "win-64"] for platform in platforms: query_platform(session, config.repositories, namespace.requirement, platform) else: query_platform(session, config.repositories, namespace.requirement, namespace.platform)
def main(argv=None): argv = argv or sys.argv[1:] plat = enstaller.plat.custom_plat p = argparse.ArgumentParser() p.add_argument("requirement", help="Requirement string (e.g. 'mayavi')") p.add_argument("--platform", help="Platform to consider (default: %(default)s). 'all' works as well", default=plat) p.add_argument("--auth", help="Authentication (default: enpkg credentials)") namespace = p.parse_args(argv) config = Configuration._from_legacy_locations() config._platform = namespace.platform if namespace.auth is None: auth = config.auth else: auth = tuple(namespace.auth.split(":")) session = Session.from_configuration(config) with session: session.authenticate(auth) if namespace.platform == "all": platforms = ["rh5-32", "rh5-64", "osx-32", "osx-64", "win-32", "win-64"] for platform in platforms: query_platform(session, config.indices, namespace.requirement, platform) else: query_platform(session, config.indices, namespace.requirement, namespace.platform)
def test__from_legacy_locations_non_existing_path(self): # When/Then with mock.patch("enstaller.config.legacy_configuration_read_search_order", return_value=[self.prefix]): with self.assertRaises(InvalidConfiguration): Configuration._from_legacy_locations()