From f6f5c94f1970100bbad53432889c4a819e3f47e0 Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Thu, 9 Jan 2025 12:02:51 +0100 Subject: [PATCH] Change specs in env file --- .github/workflows/release.yml | 1 - .github/workflows/test_fetch_release.yml | 2 +- environment.yml | 1 + tests/test_fetch_release.py | 28 +----------------------- 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e70a12f..d1e8118 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,6 @@ jobs: - shell: bash -l {0} id: fetch-release run: | - python -m pip install packaging python fetch_release.py ${{ github.event.inputs.version }} - name: Release diff --git a/.github/workflows/test_fetch_release.yml b/.github/workflows/test_fetch_release.yml index 4e6b58d..c102fce 100644 --- a/.github/workflows/test_fetch_release.yml +++ b/.github/workflows/test_fetch_release.yml @@ -13,11 +13,11 @@ jobs: - uses: mamba-org/setup-micromamba@v1 with: environment-file: environment.yml + create-args: pytest - name: Add micromamba to GITHUB_PATH run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH" - shell: bash -l {0} id: fetch-release run: | - python -m pip install packaging pytest python -m pytest tests/test_fetch_release.py -v --exitfirst diff --git a/environment.yml b/environment.yml index afedb0b..e7679e6 100644 --- a/environment.yml +++ b/environment.yml @@ -2,6 +2,7 @@ name: fetch-release-env channels: - conda-forge dependencies: + - packaging - python - requests - rich diff --git a/tests/test_fetch_release.py b/tests/test_fetch_release.py index da60cfa..4dc519d 100644 --- a/tests/test_fetch_release.py +++ b/tests/test_fetch_release.py @@ -58,7 +58,7 @@ def test_get_all_tags_github(retry_config): pytest.fail("Failed to fetch GitHub tags after multiple retries.") -@pytest.mark.parametrize("version", ("latest", "2.0.5", "2.0.5.rc0", "2.0.4alpha1"))#, "1.5.10")) +@pytest.mark.parametrize("version", ("latest", "2.0.5", "1.5.9", "2.0.5.rc0", "2.0.4alpha1")) @pytest.mark.parametrize("use_default_version", (False, True)) def test_get_micromamba_existing_version(retry_config, version, use_default_version): """ @@ -82,32 +82,6 @@ def test_get_micromamba_existing_version(retry_config, version, use_default_vers pytest.fail(f"Failed to fetch micromamba release info after multiple retries.") -#@pytest.mark.parametrize("version", ("1.5.10")) -@pytest.mark.parametrize("use_default_version", (False, True)) -def test_get_micromamba_existing_1_x(retry_config, use_default_version): - """ - Test fetching existing micromamba dev or prerelease version. - """ - max_retries = retry_config['max_retries'] - retry_delay = retry_config['retry_delay'] - - for _ in range(max_retries): - try: - version = "1.5.9"; - get_micromamba(version, use_default_version) - assert get_output_value("MICROMAMBA_NEW_VERSION") == "false" - assert get_output_value("MICROMAMBA_NEW_PRERELEASE") == None - assert get_output_value("MICROMAMBA_LATEST") == None - assert get_output_value("MICROMAMBA_VERSION") == None - print(f"Fetched micromamba release {version} successfully.") - return - except requests.exceptions.RequestException as e: - print(f"Error fetching micromamba release, retrying... {e}") - time.sleep(retry_delay) - - pytest.fail(f"Failed to fetch micromamba release info after multiple retries.") - - @pytest.mark.parametrize("use_default_version", (False, True)) def test_get_micromamba_non_existing_version(use_default_version): """