Skip to content

conftest

media_storage

media_storage(settings, tmpdir) -> None

Generate a temp path for testing media files.

Source code in conftest.py
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir) -> None:
    """Generate a temp path for testing media files."""
    settings.MEDIA_ROOT = tmpdir.strpath

mitchells_data_path

mitchells_data_path() -> Path

Return path to mitchells app data.

Source code in conftest.py
@pytest.fixture(scope="session")
def mitchells_data_path() -> Path:
    """Return path to `mitchells` app data."""
    return app_data_path("mitchells") / MITCHELLS_EXCEL_PATH

old_data_provider

old_data_provider(old_data_provider_fixture_path: Path) -> None

Load old example newspaper.DataProvider fixture.

Source code in conftest.py
@pytest.fixture
@pytest.mark.django_db
def old_data_provider(old_data_provider_fixture_path: Path) -> None:
    """Load old example `newspaper.DataProvider` fixture."""
    call_command("loaddata", old_data_provider_fixture_path)

old_data_provider_fixture_path

old_data_provider_fixture_path() -> Path

Load old example newspaper.DataProvider fixture.

Source code in conftest.py
@pytest.fixture
def old_data_provider_fixture_path() -> Path:
    """Load old example `newspaper.DataProvider` fixture."""
    return Path("lwmdb/tests/initial-test-dataprovider.json")

pytest_sessionfinish

pytest_sessionfinish(session, exitstatus)

Generate badges for docs after tests finish.

Source code in conftest.py
def pytest_sessionfinish(session, exitstatus):
    """Generate badges for docs after tests finish."""
    if exitstatus == 0:
        BADGE_PATH.parent.mkdir(parents=True, exist_ok=True)
        gen_cov_badge(["-o", f"{BADGE_PATH}", "-f"])

set_default_language

set_default_language() -> None

Ensure en-gb localisation is enforced for testing.

Source code in conftest.py
@pytest.fixture(autouse=True)
def set_default_language() -> None:
    """Ensure `en-gb` localisation is enforced for testing."""
    activate("en-gb")

updated_data_provider_path

updated_data_provider_path() -> Path

Load old example newspaper.DataProvider fixture.

Source code in conftest.py
@pytest.fixture
def updated_data_provider_path() -> Path:
    """Load old example `newspaper.DataProvider` fixture."""
    return Path("lwmdb/tests/update-test-dataprovider.json")