Skip to content

Commit

Permalink
Chane input conversion and added desc to input value help
Browse files Browse the repository at this point in the history
  • Loading branch information
chun9l committed May 22, 2024
1 parent 595fc6b commit c3f7e62
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions testing/protocol_conformity_1.0/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Pass --model_url on to individual tests

import json

def pytest_addoption(parser):
parser.addoption("--model_url", action="store", help="what model URL to connect to")
parser.addoption("--input_value", action="store", default=0.0, help="value of constant input vector to be passed to the model, since some models may not handle the default well")
parser.addoption("--input_value", action="store", default=0.0, help="input vector or constant value to fill the vector to be passed to the model, since some models may not handle the default well. No spaces allowed when inputting vector!")

def pytest_generate_tests(metafunc):
option_value = metafunc.config.option.model_url
Expand All @@ -14,11 +12,7 @@ def pytest_generate_tests(metafunc):
option_value = metafunc.config.option.input_value
if 'input_value' in metafunc.fixturenames and option_value is not None:
if isinstance(option_value, str):
option_value = json.loads(option_value)
if isinstance(option_value, list):
option_value = list(map(float, option_value))
metafunc.parametrize("input_value", [option_value])
else:
metafunc.parametrize("input_value", [float(option_value)])
option_value = eval(option_value)
metafunc.parametrize("input_value", [option_value])
else:
metafunc.parametrize("input_value", [float(option_value)])

0 comments on commit c3f7e62

Please sign in to comment.