Fix the function name in the get_minimal_required_cuda_ver_from_ptx_ver examples - #2556
Open
LeSingh1 wants to merge 1 commit into
Open
Fix the function name in the get_minimal_required_cuda_ver_from_ptx_ver examples#2556LeSingh1 wants to merge 1 commit into
LeSingh1 wants to merge 1 commit into
Conversation
…er examples The docstring's Examples section calls get_minimal_required_driver_ver_from_ptx_ver, which exists nowhere in the repo -- the function is get_minimal_required_cuda_ver_from_ptx_ver. The two docstring lines are the only occurrences of the "driver" spelling; the export in utils/__init__.py, tests/test_utils.py, docs/source/module/utils.rst and the release notes all use the "cuda" spelling, so this is a rename that missed its own docstring. The examples are doctests, and they are rendered into the public API docs via autodoc, so users are shown two calls that raise NameError. Nothing caught it because pytest is not run with --doctest-modules. Adds a test that runs doctest.testmod() over the module. It reports 2 failures before this change and 0 after, and needs no GPU or toolkit -- _ptx_utils imports only `re`.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Examplessection ofget_minimal_required_cuda_ver_from_ptx_ver()calls a functionthat does not exist:
get_minimal_required_**driver**_ver_from_ptx_verappears nowhere else in the repo — Igrepped every
.py,.pyx,.rstand.md; these two lines are the only hits. Theexport in
cuda/bindings/utils/__init__.py, the test intests/test_utils.py,docs/source/module/utils.rstand both release-notes files all use the..._cuda_ver_...spelling. It is a rename that missed its own docstring.
These are doctests, and autodoc renders this docstring into the public API docs, so users
are shown two calls that raise:
Nothing caught it because pytest is not run with
--doctest-modules(
cuda_bindings/pyproject.tomlsetsaddopts = "--benchmark-disable --showlocals").Test
test_ptx_utils_docstring_examplesrunsdoctest.testmod()over the module, next to theexisting
test_ptx_utils. It reports 2 failures onmainand 0 with this change, andneeds no GPU and no toolkit —
_ptx_utilsimports onlyre. It also covers theget_ptx_verexample, which is correct today and now stays that way.I scoped the test to this one module rather than turning on
--doctest-modulesrepo-wide;that is a bigger decision and would pull in the Cython modules' docstrings too.
Note: #2541 and #2551 also touch
cuda_bindings/tests/test_utils.py— at the end of thefile and around line 117 respectively. This one lands next to
test_ptx_utilsnear thetop, so the three are independent. Happy to rebase whichever lands last.