Skip to content

Commit

Permalink
Use session-wide common dir for schemas fixture
Browse files Browse the repository at this point in the history
Avoid creating separate copies of the schemas per xdist worker, and
resulting failures on GHA Windows runners.
  • Loading branch information
khaeru committed Jan 14, 2025
1 parent 5f21649 commit 7db1b17
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions sdmx/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,18 @@ def msg(self, path):


@pytest.fixture(scope="session")
def installed_schemas(mock_gh_api, tmp_path_factory):
def installed_schemas(worker_id, mock_gh_api, tmp_path_factory):
"""Fixture that ensures schemas are installed locally in a temporary directory."""
from sdmx.format.xml.common import install_schemas

dir = tmp_path_factory.mktemp("schemas")
if worker_id == "master":
dir = tmp_path_factory.mktemp("schemas")
else:
dir = tmp_path_factory.getbasetemp().parent.joinpath("schemas")

with mock_gh_api:
install_schemas(dir.joinpath("2.1"), Version["2.1"])
install_schemas(dir.joinpath("3.0"), Version["3.0.0"])
install_schemas(dir, Version["2.1"])
install_schemas(dir, Version["3.0.0"])

yield dir

Expand Down

0 comments on commit 7db1b17

Please sign in to comment.