Skip to content
Closed
Changes from 1 commit
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
Next Next commit
Fix doctest loading in test_enum
* remove invalid doc file existence check
* mark path to doc as module-relative by `module_relative` flag
  • Loading branch information
chgnrdv committed May 6, 2023
commit 9e4bc3c0692bcb414bd4ebd07fcee2446f00b2ce
11 changes: 5 additions & 6 deletions Lib/test/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import enum
import doctest
import inspect
import os
import pydoc
import sys
import unittest
Expand All @@ -26,11 +25,11 @@

def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite(enum))
if os.path.exists('Doc/library/enum.rst'):
tests.addTests(doctest.DocFileSuite(
'../../Doc/library/enum.rst',
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
))
tests.addTests(doctest.DocFileSuite(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the whole test library is shipped to the user, while the docs may not.

Keep the behavior as is please.

@chgnrdv chgnrdv May 6, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree that docs may not be present, but I see that path that is passed to os.path.exists should be changed to "../../Doc/library/enum.rst" in this case. Not sure about module_relative flag though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, we need to figure out the correct path.

'../../Doc/library/enum.rst',
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
module_relative=True
))
return tests

MODULE = __name__
Expand Down