Skip to content

Commit ea1a3f3

Browse files
committed
Updated RunInput to check for folder string format and removed check from run.py. Added a test to check.
1 parent d51a445 commit ea1a3f3

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

simvue/run.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,6 @@ def init(self, name=None, metadata={}, tags=[], description=None, folder='/', ru
248248
if description:
249249
data['description'] = description
250250

251-
if not folder.startswith('/'):
252-
self._error('the folder must begin with /')
253-
254251
data['folder'] = folder
255252

256253
if self._status == 'running':

tests/unit/test_simvue.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,12 @@ def test_run_init_metadata():
2424
run = Run(mode='offline')
2525

2626
with pytest.raises(RuntimeError) as exc_info:
27-
2827
run.init(metadata={'dataset.x1_lower': x1_lower, 'dataset.x1_upper': x1_upper},
2928
description="A test to validate inputs passed into metadata dictionary"
3029
)
3130

3231
assert exc_info.match(r"value is not a valid integer")
3332

34-
with pytest.raises(RuntimeError) as exc_info:
35-
36-
run.init(metadata={'dataset.x1_lower': x1_lower, 'dataset.x1_upper': x1_upper}, tags=1,
37-
description="A test to validate inputs passed into folder"
38-
)
39-
40-
assert exc_info.match(r"value is not a valid integer")
41-
4233
def test_run_init_tags():
4334
"""
4435
Check that run.init throws an exception if tags are not a list
@@ -52,10 +43,28 @@ def test_run_init_tags():
5243
run = Run(mode='offline')
5344

5445
with pytest.raises(RuntimeError) as exc_info:
55-
5646
run.init(metadata={'dataset.x1_lower': x1_lower, 'dataset.x1_upper': x1_upper}, tags=1,
5747
description="A test to validate tag inputs passed into run.init"
5848
)
5949

6050
assert exc_info.match(r"value is not a valid list")
6151

52+
def test_run_init_folder():
53+
"""
54+
Check that run.init throws an exception if folder input is not specified correctly
55+
"""
56+
os.environ["SIMVUE_TOKEN"] = "test"
57+
os.environ["SIMVUE_URL"] = "https://simvue.io"
58+
59+
x1_lower = 2
60+
x1_upper = 6
61+
62+
run = Run(mode='offline')
63+
64+
with pytest.raises(RuntimeError) as exc_info:
65+
run.init(metadata={'dataset.x1_lower': x1_lower, 'dataset.x1_upper': x1_upper}, tags=[1,2,3], folder='test_folder',
66+
description="A test to validate folder input passed into run.init"
67+
)
68+
69+
assert exc_info.match(r"string does not match regex")
70+

0 commit comments

Comments
 (0)