From fd175661800a49dbac0029680073cfe069f1741c Mon Sep 17 00:00:00 2001 From: Stefano Apostolico Date: Mon, 23 Dec 2024 21:18:22 +0100 Subject: [PATCH] updates fixtures --- .github/workflows/lint.yml | 2 +- tests/contrib/hope/test_h_validators.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9a61d9d..d33db90 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -58,7 +58,7 @@ jobs: run: pip install ruff - name: Check syntax # Stop the build if there are Python syntax errors or undefined names - run: ruff check src/ + run: ruff check --output-format concise src/ - name: Warnings run: ruff format --check diff --git a/tests/contrib/hope/test_h_validators.py b/tests/contrib/hope/test_h_validators.py index 03f7bd5..0683897 100644 --- a/tests/contrib/hope/test_h_validators.py +++ b/tests/contrib/hope/test_h_validators.py @@ -1,12 +1,15 @@ from typing import TYPE_CHECKING import pytest +from faker import Faker from country_workspace.contrib.hope.validators import FullHouseholdValidator if TYPE_CHECKING: from country_workspace.models import Household +fake = Faker() + @pytest.fixture def program(household_checker, individual_checker): @@ -21,10 +24,16 @@ def program(household_checker, individual_checker): @pytest.fixture -def household(program) -> "Household": +def household(program, worker_id) -> "Household": from testutils.factories import HouseholdFactory - return HouseholdFactory(batch__program=program, individuals=[], batch__country_office=program.country_office) + def name(instance: "Household", step: int) -> str: + name = fake.last_name() + return f"{name} @{worker_id} #{step}" + + return HouseholdFactory( + name=name, batch__program=program, individuals=[], batch__country_office=program.country_office + ) def test_head(household: "Household"):