Skip to content

Commit

Permalink
fix: ensuring env deletion after test
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Nov 28, 2024
1 parent e58b906 commit 819e105
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tests/test_env_bypass.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
import os

import pytest

from uv_dynamic_versioning import schemas
from uv_dynamic_versioning.main import get_version


def test_get_version():
version = "1.1.1"
@pytest.fixture
def version():
return "1.1.1"


@pytest.fixture
def set_uv_dynamic_versioning_bypass(version: str):
os.environ["UV_DYNAMIC_VERSIONING_BYPASS"] = version
version = get_version(schemas.UvDynamicVersioning()).unwrap()

assert version == version
try:
yield version
finally:
del os.environ["UV_DYNAMIC_VERSIONING_BYPASS"]


@pytest.mark.usefixtures("set_uv_dynamic_versioning_bypass")
def test_get_version(version: str):
got = get_version(schemas.UvDynamicVersioning()).unwrap()
assert got == version

0 comments on commit 819e105

Please sign in to comment.