Skip to content
Snippets Groups Projects

Detect cycle automatically in update_config script

Merged Philipp Schmidt requested to merge feat/update-config-auto-cycle into master
Files
2
@@ -9,6 +9,7 @@ import yaml
import zmq
from webservice.update_config import (
_find_cycle,
_add_available_configs_to_arg_parser,
_create_new_config_from_args_input,
main,
@@ -174,3 +175,19 @@ def test_create_new_config_from_args_input(instrument, args, expected):
available_conf=EXPECTED_CONF,
)
assert new_conf == expected
def test_find_cycle(tmp_path):
proposal_path = tmp_path / 'CALLAB' / '202301' / 'p002003'
proposal_path.mkdir(parents=True, exist_ok=True)
assert _find_cycle('2003', tmp_path) == '202301'
assert _find_cycle('002003', tmp_path) == '202301'
with pytest.raises(ValueError):
# Not existing proposal.
_find_cycle('2004')
with pytest.raises(ValueError):
# Not a number.
_find_cycle('p2004')
Loading