def test_env_from_project_file_invalid_config(tmpdir): d1 = tmpdir.mkdir("p1") p1 = d1.join("vergeml.yaml") p1.write("data:\n inputz: images") with pytest.raises( VergeMLError, match=r".*Invalid option 'data.inputz'. Did you mean 'data.input'.*" ): _env_from_args({'project-file': str(p1)}, {}, None)
def test_cmdline_overrides_project_file(tmpdir): d1 = tmpdir.mkdir("p1") p1 = d1.join("vergeml.yaml") p1.write("random-seed: 1234") env = _env_from_args({ 'project-file': str(p1), 'random-seed': 456 }, {}, None) assert env.get('random-seed') == 456
def test_env_from_args(): default_env = _env_from_args({}, {}, None) assert default_env assert default_env.get('samples-dir') == 'samples' assert default_env.get('test-split') == '10%' assert default_env.get('val-split') == '10%' assert default_env.get('cache-dir') == '.cache' assert default_env.get('random-seed') == 2204 assert default_env.get('trainings-dir') == 'trainings'
def test_env_from_project_file_invalid(tmpdir): d1 = tmpdir.mkdir("p1") p1 = d1.join("vergeml.yaml") p1.write("random-seed = 22041980") with pytest.raises(VergeMLError): _env_from_args({'project-file': str(p1)}, {}, None)
def test_env_from_project_file(tmpdir): d1 = tmpdir.mkdir("p1") p1 = d1.join("vergeml.yaml") p1.write("random-seed: 22041980") env = _env_from_args({'project-file': str(p1)}, {}, None) assert env.get('random-seed') == 22041980