June 2019
Beginner to intermediate
770 pages
19h 24m
English
It's common to have a large number of similar examples for a test case. In previous sections, we talked about having users or analysts create spreadsheets with examples of inputs and outputs. This can be helpful for permitting direct input to the software development process. We need our testing tools to work with the CSV example files as directly as possible.
With pytest, we can apply parameters to a fixture. The pytest runner will use each object in the parameter collection to run the test function repeatedly. To build a parameterized fixture, we can use code like the following example:
import csvwith (Path.cwd() / "Chapter_17" / "ch17_data.csv").open() as source: rdr = csv.DictReader(source) rtd_cases = ...
Read now
Unlock full access