Skip to content
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

gh-93096: Remove run block in heapq #131130

Closed
wants to merge 1 commit into from

Conversation

donBarbos
Copy link
Contributor

@donBarbos donBarbos commented Mar 12, 2025

we can use next command for doctests: ./python -m doctest Lib/heapq.py -v

and we already loading doctest in next line:

def load_tests(loader, tests, ignore):
# The 'merge' function has examples in its docstring which we should test
# with 'doctest'.
#
# However, doctest can't easily find all docstrings in the module (loading
# it through import_fresh_module seems to confuse it), so we specifically
# create a finder which returns the doctests from the merge method.
class HeapqMergeDocTestFinder:
def find(self, *args, **kwargs):
dtf = doctest.DocTestFinder()
return dtf.find(py_heapq.merge)
tests.addTests(doctest.DocTestSuite(py_heapq,
test_finder=HeapqMergeDocTestFinder()))
return tests

@donBarbos
Copy link
Contributor Author

cc @vstinner

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@rhettinger
Copy link
Contributor

I don't think this addresses any known or real user problem. It just makes life more difficult for the module maintainer.

@donBarbos
Copy link
Contributor Author

I don't think this addresses any known or real user problem. It just makes life more difficult for the module maintainer.

This looks like redundant code. And we already have more general way to run doctest (via python -m doctest)

@rhettinger rhettinger closed this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants