Counting cases and fixture setups in a parametrized pytest module

All of the following code is in one pytest module, test_site.py. Assume every test case runs.


Python
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.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Doctest Questions: