Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/kernel/test_function_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,21 @@ def test_flattened_build_replaces_function(self):
self.skipTest(f'HuggingFace unreachable: {e}')
try:
from kernels import has_kernel
from kernels._versions import select_revision_or_version
from kernels.utils import get_kernel
except Exception:
self.skipTest('kernels package missing has_kernel.')
if not has_kernel('kernels-test/flattened-build'):
self.skipTest('kernels-test/flattened-build not available.')
try:
revision = select_revision_or_version(
'kernels-test/flattened-build',
revision=None,
version=None,
)
get_kernel('kernels-test/flattened-build', revision=revision)
except Exception as exc:
self.skipTest(f'kernels-test/flattened-build cannot be loaded in this env: {exc}')
Comment on lines +63 to +71
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The repository ID 'kernels-test/flattened-build' is repeated here and elsewhere in this test method (e.g., lines 61, 88). To improve maintainability and reduce the chance of typos, consider defining this string as a constant at the beginning of the method and reusing it.

For example:

repo_id = 'kernels-test/flattened-build'
# ... then use repo_id in has_kernel, select_revision_or_version, get_kernel, etc.


_ensure_test_packages()
module_name = 'tests.kernel._tmp_flattened_build_module'
Expand Down
Loading