def packages_can_be_installed_from_html_index(create_operations): with _package_source(testing.HelloWorld.BUILD) as package_source_dir: with start_index_server() as index_server: source = index_server.add_source(package_source_dir) with create_temporary_dir() as target_dir: operations = create_operations(indices=[index_server.index_url()]) operations.install(source.full_name, target_dir, params={}) output = _check_output([os.path.join(target_dir, "hello")]) assert_equal(testing.HelloWorld.EXPECTED_OUTPUT, output)
def can_install_package_when_build_step_is_disabled_if_pre_built_package_can_be_found(create_operations): with _package_source(testing.HelloWorld.BUILD) as package_source_dir: with start_index_server() as index_server: indices = [index_server.index_url()] operations_for_build = create_operations(indices=indices) with create_temporary_dir() as temp_dir: package_tarball = operations_for_build.get_package_tarball(package_source_dir, temp_dir) index_server.add_package_tarball(package_tarball) with create_temporary_dir() as install_dir: operations = create_operations(enable_build=False, indices=indices) operations.install(package_source_dir, install_dir) output = _check_output([os.path.join(install_dir, "hello")]) assert_equal(testing.HelloWorld.EXPECTED_OUTPUT, output)
def error_is_raised_if_build_step_is_disabled_and_pre_built_package_cannot_be_found(create_operations): operations = create_operations(enable_build=False) with _package_source(testing.HelloWorld.BUILD) as package_source_dir: with create_temporary_dir() as target_dir: assert_raises(PackageNotAvailableError, lambda: operations.install(package_source_dir, target_dir))