Test frontend: niente piu' dipendenza dall'ordine sulla stazione (TieMeasureFlow#79)
test_measure.py non ricarica piu' config/blueprints.measure (monkeypatch.setattr, annullato al teardown); TestTaskComplete e test_recipe_rules_ui.py fissano la stazione esplicitamente con una fixture autouse. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,17 @@ a start button that will not start, a description that reads the way it was
|
||||
written.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _no_station(monkeypatch):
|
||||
# These tests assume no station is configured (e.g. _task_list feeds the mock a
|
||||
# fixed number of replies, with no /production-runs/current among them); pin it
|
||||
# so a STATION_CODE left behind by an earlier test cannot change the call count (#79).
|
||||
# Tests that need a station set it themselves, after this fixture has run.
|
||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", None)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Point 11 - line breaks and bold, and nothing else
|
||||
@@ -197,13 +208,9 @@ def test_avvia_is_untouched_when_nothing_is_required(
|
||||
def test_selection_screen_carries_the_traceability_rules(
|
||||
logged_in_client, mock_api_client, monkeypatch,
|
||||
):
|
||||
monkeypatch.setenv("STATION_CODE", "ST-TEST")
|
||||
import importlib
|
||||
|
||||
import config
|
||||
importlib.reload(config)
|
||||
import blueprints.measure
|
||||
importlib.reload(blueprints.measure)
|
||||
# Patch instead of reload()ing config/blueprints.measure: the patch is undone at
|
||||
# teardown, a reload would leave ST-TEST behind for later tests (#79).
|
||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", "ST-TEST")
|
||||
|
||||
mock_api_client.get_station_recipes.return_value = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user