Skip to content

Commit

Permalink
fix(tests): clear SOURCE_DATE_EPOCH env var
Browse files Browse the repository at this point in the history
Resolves: python-poetry/poetry#10011

fix(tests): clear SOURCE_DATE_EPOC from env if set
  • Loading branch information
abn committed Jan 17, 2025
1 parent 528e796 commit e2ac528
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import sys
import tempfile

Expand Down Expand Up @@ -120,3 +121,10 @@ def with_mocked_get_vcs(mocker: MockerFixture) -> None:
"poetry.core.vcs.git.Git.run", return_value="This is a mocked Git.run() output."
)
mocker.patch("poetry.core.vcs.get_vcs", return_value=Git())


@pytest.fixture(autouse=True)
def clear_env_source_date_epoch() -> None:
"""Clear SOURCE_DATE_EPOCH from environment to avoid non-deterministic failures"""
if "SOURCE_DATE_EPOCH" in os.environ:
del os.environ["SOURCE_DATE_EPOCH"]

0 comments on commit e2ac528

Please sign in to comment.