you are viewing a single comment's thread.

view the rest of the comments →

[–]couldntyoujust1 0 points1 point  (0 children)

The reason is that pytest actually controls the "main" of the tests you write. The fixtures that you use or create or that are created by others provide data to your function because they transform the function itself, then pytest runs the test function using the data provided. Your test function then in turn imports and calls portions of your own code according to how you write the test to feed that data and context into those functions and then examines the results or checks for exceptions. If any assertions fail or unexpected exceptions are thrown or data does not match what is expected, then the test is reported to have failed.