Skip to content

Commit

Permalink
Rename patch_id_generators to setup_id_generators.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Oct 21, 2024
1 parent 74b28e2 commit 7598c4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@


@pytest.fixture(autouse=True, scope="function")
def patch_id_generators() -> Generator[None, None, None]:
"""Patch ID generators with a new one to get repeatability in plan outputs before every test.
def setup_id_generators() -> Generator[None, None, None]:
"""Setup ID generation to start numbering at a specific value to get repeatability in generated IDs.
Plan outputs contain IDs, so if the IDs are not consistent from run to run, there will be diffs in the actual vs.
expected outputs during a test.
Fixtures may generate IDs, so this needs to be done before every test.
"""
with SequentialIdGenerator.id_number_space(start_value=IdNumberSpace.for_test_start().start_value):
yield None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These imports are required to properly set up pytest fixtures.
from __future__ import annotations

from metricflow_semantics.test_helpers.id_helpers import patch_id_generators # noqa: F401
from metricflow_semantics.test_helpers.id_helpers import setup_id_generators # noqa: F401

from tests_metricflow_semantics.fixtures.manifest_fixtures import * # noqa: F401, F403
from tests_metricflow_semantics.fixtures.setup_fixtures import * # noqa: F401, F403
2 changes: 1 addition & 1 deletion tests_metricflow/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These imports are required to properly set up pytest fixtures.
from __future__ import annotations

from metricflow_semantics.test_helpers.id_helpers import patch_id_generators # noqa: F401
from metricflow_semantics.test_helpers.id_helpers import setup_id_generators # noqa: F401

from tests_metricflow.fixtures.cli_fixtures import * # noqa: F401, F403
from tests_metricflow.fixtures.dataflow_fixtures import * # noqa: F401, F403
Expand Down

0 comments on commit 7598c4b

Please sign in to comment.