Fix directory layout using namespace (#11076)
Directory layouts using ${NAMESPACE} were broken. This addresses that and adds a test to prevent regression.
This commit is contained in:
parent
3c641f47cd
commit
a9ae507152
@ -3237,7 +3237,7 @@ def write(s, c=None):
|
|||||||
hashlen = None
|
hashlen = None
|
||||||
out.write(fmt % (self.dag_hash(hashlen)))
|
out.write(fmt % (self.dag_hash(hashlen)))
|
||||||
elif named_str == 'NAMESPACE':
|
elif named_str == 'NAMESPACE':
|
||||||
out.write(fmt % transform(self.namespace))
|
out.write(fmt % transform(self, self.namespace))
|
||||||
elif named_str.startswith('DEP:'):
|
elif named_str.startswith('DEP:'):
|
||||||
_, dep_name, dep_option = named_str.lower().split(':', 2)
|
_, dep_name, dep_option = named_str.lower().split(':', 2)
|
||||||
dep_spec = self[dep_name]
|
dep_spec = self[dep_name]
|
||||||
|
@ -70,6 +70,13 @@ def test_yaml_directory_layout_parameters(
|
|||||||
arch_path_package = layout_arch_package.relative_path_for_spec(spec)
|
arch_path_package = layout_arch_package.relative_path_for_spec(spec)
|
||||||
assert(arch_path_package == spec.format(arch_scheme_package))
|
assert(arch_path_package == spec.format(arch_scheme_package))
|
||||||
|
|
||||||
|
# Test separation of namespace
|
||||||
|
ns_scheme_package = "${ARCHITECTURE}/${NAMESPACE}/${PACKAGE}-${VERSION}-${HASH:7}" # NOQA: ignore=E501
|
||||||
|
layout_ns_package = YamlDirectoryLayout(str(tmpdir),
|
||||||
|
path_scheme=ns_scheme_package)
|
||||||
|
ns_path_package = layout_ns_package.relative_path_for_spec(spec)
|
||||||
|
assert(ns_path_package == spec.format(ns_scheme_package))
|
||||||
|
|
||||||
# Ensure conflicting parameters caught
|
# Ensure conflicting parameters caught
|
||||||
with pytest.raises(InvalidDirectoryLayoutParametersError):
|
with pytest.raises(InvalidDirectoryLayoutParametersError):
|
||||||
YamlDirectoryLayout(str(tmpdir),
|
YamlDirectoryLayout(str(tmpdir),
|
||||||
|
Loading…
Reference in New Issue
Block a user