Open CristhianBoujon opened 6 years ago
Hi! Thanks for notifying. I think it should be because of this https://github.com/TvoroG/pytest-lazy-fixture/issues/16. Try to import lazy_fixture:
from pytest_lazyfixture import lazy_fixture
and use it instead of pytest.lazy_fixture
.
Actually, I just know realized that you are using lazy_fixture
not quite right. lazy_fixture
should be the value of pytest.mark.parametrize
argument. In your case it can be rewritten like this:
@pytest.mark.parametrize("test_input,test_input_source,expected", [
({
"input": {
"format": "csv",
},
"split": {
"targets": "c",
"seeds": [1, 5, 34],
"params":{
"train_size": 0.7,
"random_state": 42
}
}
}, pytest.lazy_fixture("dataset_path"), 8)
])
def test_dataset(test_input, test_input_source, expected):
print(test_input)
assert False
test_input represents a json and input.source is a required property of that json which is dynamic and I need to fill it with a path generated with dataset_path fixture
Sorry but I'm not fully understand your problem :) You have this json which has required input.source
property. input.source
has to be generated by dataset_path
. Is it possible to restore this field inside of test?
@pytest.mark.parametrize("test_input,test_input_source,expected", [
({
"input": {
"format": "csv",
},
"split": {
"targets": "c",
"seeds": [1, 5, 34],
"params":{
"train_size": 0.7,
"random_state": 42
}
}
}, pytest.lazy_fixture("dataset_path"), 8)
])
def test_dataset(test_input, test_input_source, expected):
test_input['input']['source'] = test_input_source
print(test_input)
assert False
Yes, it is possible, I actually do that but I think this is an issue, anyway
I have installed pytest-lazy-fixture:
When I run pytest I get error:
Tests: