From f28f31f6bbabee7ae23e475fd5fb36598352c036 Mon Sep 17 00:00:00 2001 From: Bela Stoyan Date: Sun, 17 Dec 2023 19:17:32 +0100 Subject: [PATCH] fix test_functionality on windows 1337 leetcode --- test/end-to-end/test_simple.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/end-to-end/test_simple.py b/test/end-to-end/test_simple.py index 4285bf6b1..2e3678a09 100644 --- a/test/end-to-end/test_simple.py +++ b/test/end-to-end/test_simple.py @@ -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}" @@ -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 @@ -182,10 +184,16 @@ 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( @@ -193,7 +201,7 @@ def test_auth_file(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path, m tmp_path, custom_channels=["conda-forge", "https://repo.prefix.dev/setup-pixi-test"], ) - + auth_file.write_text( json.dumps( {