All of the following code is in one pytest module, test_site.py. Assume every test case runs.
import pytest @pytest.fixture(scope="module") def server(): ... @pytest.fixture def browser_session(server): ... @pytest.mark.parametrize("width", [375, 768, 1440]) @pytest.mark.parametrize("browser", ["chrome", "firefox", "safari", "edge"]) def test_layout(browser_session, browser, width): ... @pytest.mark.parametrize("path", ["/", "/login", "/cart", "/help", "/about"]) def test_status_code(server, path): ...
Give each answer as a whole number: the total number of test cases pytest collects, the number of times the setup of browser_session runs, and the number of times the setup of server runs.
Unlock full course notes by signing up
Predicting pytest outcomes for a buggy leap-year function
A developer implements a leap-year check but forgets the century rule (years divisible by 100 are leap years only when also divisible by 400):
The test module is:
In the table, each row names a test case by its test and year; the row rejects text is test_rejects_text. Fill in each case's pytest outcome using one of the words passed, failed, error or skipped, then give the number of failed cases and the exit code pytest returns.