-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Test built extension wheels in CI #9420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,12 +9,15 @@ | |||||
|
|
||||||
| import logging | ||||||
| import os | ||||||
| from pathlib import Path | ||||||
| import subprocess | ||||||
| import sys | ||||||
| import tempfile | ||||||
| import shutil | ||||||
| import shlex | ||||||
|
|
||||||
| from subprocess import check_output, CalledProcessError, run | ||||||
| from typing import Optional | ||||||
| from util import SRC_PATH | ||||||
|
|
||||||
| logger = logging.getLogger(__name__) | ||||||
|
|
@@ -64,7 +67,7 @@ def run_command(cmd, check_return_code=False, cwd=None): | |||||
| raise RuntimeError(f"{cmd} failed") | ||||||
|
|
||||||
|
|
||||||
| def test_extension(): | ||||||
| def test_extension(whl_dir: Optional[Path] = None): | ||||||
| for pkg_name, ext_path in ALL_TESTS: | ||||||
| ext_name = ext_path.split('/')[-1] | ||||||
| logger.info(f'installing extension: {ext_name}') | ||||||
|
|
@@ -86,22 +89,46 @@ def test_extension(): | |||||
| cmd = ['azdev', 'extension', 'remove', ext_name] | ||||||
| run_command(cmd, check_return_code=True) | ||||||
|
|
||||||
|
|
||||||
| def test_source_wheels(): | ||||||
| if whl_dir is not None: | ||||||
| logger.info(f'installing extension wheel: {ext_name}') | ||||||
| wheel_path = next(whl_dir.glob(f"{ext_name}*.whl")) | ||||||
| subprocess.run( | ||||||
| f"az extension add -y -s {wheel_path}".split(" "), | ||||||
|
||||||
| f"az extension add -y -s {wheel_path}".split(" "), | |
| ["az", "extension", "add", "-y", "-s", str(wheel_path)], |
Outdated
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using .split(\" \") will incorrectly split extension names that contain spaces (if any exist). Use a list directly: [\"az\", ext_name, \"--help\"]
| f"az {ext_name} --help".split(" "), | |
| ["az", ext_name, "--help"], |
Outdated
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using .split(\" \") will incorrectly split extension names that contain spaces (if any exist). Use a list directly: [\"az\", \"extension\", \"remove\", \"-n\", ext_name]
| f"az extension remove -n {ext_name}".split(" "), | |
| ["az", "extension", "remove", "-n", ext_name], |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The raise statement should instantiate an exception, not call it as a function. This should be raise RuntimeError(...) or similar exception class.
| raise("Unable to build extension {} : {}".format(s, err)) | |
| raise RuntimeError("Unable to build extension {} : {}".format(s, err)) |
Outdated
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When whl_dir is None, str(whl_dir) converts it to the string \"None\" instead of keeping it as None. This bypasses the null check on line 130. Use str(whl_dir) if whl_dir else None instead.
| str(whl_dir), | |
| str(whl_dir) if whl_dir else None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
next()call will raiseStopIterationif no matching wheel file is found. Add a default value or handle the exception to provide a more informative error message. Consider:wheel_path = next(whl_dir.glob(f\"{ext_name}*.whl\"), None)followed by a check.