From 76dc46a41c81002150be0a6e2cbb3811bede3e35 Mon Sep 17 00:00:00 2001 From: Christophe Haen Date: Wed, 13 Mar 2024 15:15:03 +0100 Subject: [PATCH] Workaround for the setuptools issue used by Autorest (https://github.com/Azure/autorest.python/issues/2449) --- .github/workflows/main.yml | 2 ++ diracx-client/tests/test_regenerate.py | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb44cdd2..0d5aafc4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -151,4 +151,6 @@ jobs: npm install -g autorest - name: Run autorest run: | + autorest --python --help + $HOME/.autorest/\@autorest_python\@*/node_modules/\@autorest/python/venv/bin/python -m pip install --upgrade setuptools pytest --no-cov --regenerate-client diracx-client/tests/test_regenerate.py diff --git a/diracx-client/tests/test_regenerate.py b/diracx-client/tests/test_regenerate.py index 5481db54..bbba7ae3 100644 --- a/diracx-client/tests/test_regenerate.py +++ b/diracx-client/tests/test_regenerate.py @@ -10,6 +10,9 @@ # pytestmark = pytest.mark.enabled_dependencies(["ConfigSource", "AuthSettings"]) +AUTOREST_VERSION = "6.13.7" + + @pytest.fixture def test_client(client_factory): with client_factory.unauthenticated() as client: @@ -53,8 +56,12 @@ def test_regenerate_client(test_client, tmp_path): "--namespace=client", f"--output-folder={output_folder}", ] + # This is required to be able to work offline - cmd += ["--use=@autorest/python@6.4.11"] + # TODO: if offline, find the version already installed + # and use it + # cmd += [f"--use=@autorest/python@{AUTOREST_VERSION}"] + subprocess.run(cmd, check=True) cmd = ["pre-commit", "run", "--all-files"] @@ -64,3 +71,7 @@ def test_regenerate_client(test_client, tmp_path): subprocess.run(cmd, check=True, cwd=repo_root) if repo.is_dirty(path=repo_root / "src" / "diracx" / "client"): raise AssertionError("Client was regenerated with changes") + + +if __name__ == "__main__": + print(AUTOREST_VERSION)