-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add tests for pbs_installer_supported_arch #10686
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 all 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 |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| from tests.helpers import flatten_dict | ||
| from tests.helpers import isolated_environment | ||
| from tests.helpers import pbs_installer_supported_arch | ||
|
|
||
|
|
||
| def test_flatten_dict() -> None: | ||
|
|
@@ -44,3 +45,15 @@ def test_isolated_environment_updates_environ() -> None: | |
| with isolated_environment(environ={"NEW_VAR": "new_value"}): | ||
| assert os.environ["NEW_VAR"] == "new_value" | ||
| assert "NEW_VAR" not in os.environ | ||
|
|
||
| #---------------------2 new tests----------------------- | ||
|
|
||
| def test_pbs_installer_supported_arch_accepts_supported_archs() -> None: | ||
| assert pbs_installer_supported_arch("x86_64") is True | ||
| assert pbs_installer_supported_arch("amd64") is True | ||
| assert pbs_installer_supported_arch("arm64") is True | ||
|
|
||
|
|
||
| def test_pbs_installer_supported_arch_rejects_unsupported_archs() -> None: | ||
| assert pbs_installer_supported_arch("sparc") is False | ||
| assert pbs_installer_supported_arch("mips") is False | ||
|
Comment on lines
+57
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (testing): Consider adding negative tests for near-miss architectures (e.g. x86, armv7l) to ensure correct rejection. Currently the rejection test only uses clearly unsupported architectures like |
||
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.
suggestion (testing): Add tests for architecture aliases and edge cases (e.g. aarch64, case differences, empty string).
Beyond the main happy-path values, please add tests for alias and edge inputs that this helper should handle, e.g.
"aarch64", case variants like"ARM64", and clearly invalid-but-string inputs such as""or whitespace-only. That will document and lock in the expected normalization and failure behavior.Suggested implementation:
These changes assume:
osis already imported earlier intests/test_helpers.py, sincetest_flatten_dictusesos.environ.pbs_installer_supported_arch("aarch64")and case variants like"ARM64"are expected to be treated as supported; if the helper currently does not normalize aliases/case that way, you will need to update its implementation intests/helpers.pyaccordingly.test_pbs_installer_supported_arch_rejects_invalid_stringsto cover them.