Replies: 1 comment 1 reply
-
Currently fixtures are not available at collection time Currently we don't document a best practice for those patterns If feasible id recommend creating a plugin object that handles ownership of the loaded data Unfortunately I won't be able to provide an example soon |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm building a test framework, trying to simply the code to create a test_case.
Here's my confusion:
I have a test class, which includes multiple test cases.
And I use one csv file to save test data that need for these test cases.
I want to read csv file as setup of test class, and get test data for specific test case by test case's name according to fixture methods in conftest.py.
When csv file is read, the function return a dict, keys are name of test case, values are list of test data, and test data is saved as dict, keys are argsname of test method, values are argsvalue of the argsname.
I've tried to use two fixtures:
but only get one row of test data by this method, which actually multiple rows in csv file.
So I check the document, it shows if fixture need to be executed multiple times, I should use params to transfer multiple params, but I don't know how to set my return value of fixture method to params.
Then I found pytest_generate_tests(), but it seems that hook method can't call fixutre method, so this way didn't work for me.
If there's anyway can fix my problem? Or did I get something wrong so that I failed?
Beta Was this translation helpful? Give feedback.
All reactions