Skip to content

Commit

Permalink
fix test_functionality on windows
Browse files Browse the repository at this point in the history
1337 leetcode
  • Loading branch information
0xbe7a committed Dec 17, 2023
1 parent 5ba88b5 commit f28f31f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/end-to-end/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def rattler_build():
else:
base_path = Path(__file__).parent.parent.parent
executable_name = "rattler-build"
if os.name == 'nt':
if os.name == "nt":
executable_name += ".exe"

release_path = base_path / f"target/release/{executable_name}"
Expand All @@ -64,7 +64,9 @@ def rattler_build():


def test_functionality(rattler_build: RattlerBuild):
assert rattler_build("--help").startswith("Usage: rattler-build [OPTIONS]")
suffix = ".exe" if os.name == "nt" else ""

assert rattler_build("--help").startswith(f"Usage: rattler-build{suffix} [OPTIONS]")


@pytest.fixture
Expand Down Expand Up @@ -182,18 +184,24 @@ def test_pkg_hash(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path):
expected_hash = variant_hash({"target_platform": host_subdir()})
assert pkg.name.endswith(f"pkg_hash-1.0.0-{expected_hash}_my_pkg.tar.bz2")

@pytest.mark.skipif(not os.environ.get("PREFIX_DEV_READ_ONLY_TOKEN", ""), reason="requires PREFIX_DEV_READ_ONLY_TOKEN")
def test_auth_file(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, monkeypatch):

@pytest.mark.skipif(
not os.environ.get("PREFIX_DEV_READ_ONLY_TOKEN", ""),
reason="requires PREFIX_DEV_READ_ONLY_TOKEN",
)
def test_auth_file(
rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, monkeypatch
):
auth_file = tmp_path / "auth.json"
monkeypatch.setenv('RATTLER_AUTH_FILE', str(auth_file))
monkeypatch.setenv("RATTLER_AUTH_FILE", str(auth_file))

with pytest.raises(CalledProcessError):
rattler_build.build(
recipes / "private-repository",
tmp_path,
custom_channels=["conda-forge", "https://repo.prefix.dev/setup-pixi-test"],
)

auth_file.write_text(
json.dumps(
{
Expand Down

0 comments on commit f28f31f

Please sign in to comment.