Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spras/config/container_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def from_container_settings(settings: ContainerSettings, hash_length: int) -> "P
unpack_singularity=unpack_singularity,
base_url=container_base_url,
prefix=container_prefix,
enable_profiling=settings.enable_profiling,
hash_length=hash_length,
images=dict(settings.images),
)
16 changes: 16 additions & 0 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,22 @@ def test_config_container_images_invalid_algorithm(self):
with pytest.raises(ValueError, match="Unknown algorithm name 'typo_algo'"):
config.init_global(test_config)

def test_config_container_enable_profiling(self):
# enable_profiling must survive the ContainerSettings -> ProcessedContainerSettings
# conversion in from_container_settings(). containers.py reads it off the processed
# settings at runtime, so if it isn't propagated the profiling code path never runs.
# Regression test for the field being silently dropped during that conversion.
test_config = get_test_config()

# Default: absent from config --> False
config.init_global(test_config)
assert config.config.container_settings.enable_profiling is False

# Explicitly enabled --> must propagate to the processed settings as True
test_config["containers"]["enable_profiling"] = True
config.init_global(test_config)
assert config.config.container_settings.enable_profiling is True

def test_error_dataset_label(self):
test_config = get_test_config()
error_test_dicts = [{"label": "test$"}, {"label": "@test'"}, {"label": "[test]"}, {"label": "test-test"},
Expand Down
Loading