Ejemplo n.º 1
0
 def _get_package(self, params):
     target_dir = os.path.join(self._test_dir, str(uuid.uuid4()))
     package_source_dir = os.path.join(self._test_dir, str(uuid.uuid4()))
     package_provider = CachingPackageProvider(
         cacher=self._cacher,
         underlying_provider=self._underlying_provider,
     )
     request = create_package_request(PackageSource.local(package_source_dir), params)
     package_provider.provide_package(request, target_dir)
Ejemplo n.º 2
0
def error_is_raised_if_build_script_is_missing():
    files = [
        plain_file("whack/whack.json", json.dumps({})),
    ]
    with create_temporary_dir(files) as package_source_dir:
        package_source = PackageSource.local(package_source_dir)
        request = create_package_request(package_source, {})
        with create_temporary_dir() as target_dir:
            assert_raises(
                FileNotFoundError,
                ("whack/build script not found in package source {0}".format(package_source_dir), ),
                lambda: build(request, target_dir),
            )
Ejemplo n.º 3
0
def explicit_params_override_default_params():
    description = {"defaultParams": {"version": "42"}}
    with _package_source("echo $VERSION > $1/version", description) as package_source:
        with create_temporary_dir() as target_dir:
            build(create_package_request(package_source, {"version": "43"}), target_dir)
            assert_equal("43\n", read_file(os.path.join(target_dir, "version")))
Ejemplo n.º 4
0
def build_uses_default_value_for_param_if_param_not_explicitly_set():
    description = {"defaultParams": {"version": "42"}}
    with _package_source("echo $VERSION > $1/version", description) as package_source:
        with create_temporary_dir() as target_dir:
            build(create_package_request(package_source, {}), target_dir)
            assert_equal("42\n", read_file(os.path.join(target_dir, "version")))
Ejemplo n.º 5
0
def build_uses_params_as_environment_variables_in_build():
    with _package_source("echo $VERSION > $1/version", {}) as package_source:
        with create_temporary_dir() as target_dir:
            build(create_package_request(package_source, {"version": "42"}), target_dir)
            assert_equal("42\n", read_file(os.path.join(target_dir, "version")))