gh-108303: Move all doctest related files and tests to Lib/test/test_doctest/#112109
Conversation
| self.lines = lines | ||
|
|
||
| def readline(self): | ||
| line = self.lines.pop(0) |
There was a problem hiding this comment.
Calling list.pop(0) frequently is inefficient. Maybe the constructor should create a collections.deque() and call self.lines.popleft() instead?
There was a problem hiding this comment.
It is usually used in cases like sys.stdin = FakeInput(['next', 'print(x)', 'continue']), I don't think it matters much. But, I can do this if you want :)
Co-authored-by: Brett Cannon <brett@python.org>
|
I solved merge conflicts, cc @vstinner |
|
Since we are moving code, would it be worth it to split test_doctest.py which has 3 374 lines into multiple files? I found the following tests / test cases:
For example, it would be nice to have 1000 lines or less per file. If you are interested to make such change, I suggest creating a new PR, so we can compare. About test_doctest2: why is it a separated file? Should it be renamed? The docstring says:
I suppose that 2.2 stands for Python 2.2. Is it a test on the "parser" or "test discovery"? |
I don't think so, because moving a file is a rather simple operation. It does not spoil I work with
I agree that the naming of this file is not optimal. It also clashes with Looks like that all tests from it are just duplicates. We already test classes, classmethods, staticmethods and everything else in It has some details that I want to explicitly port:
|
vstinner
left a comment
There was a problem hiding this comment.
I cannot see where Lib/test/test_doctest2.py test goes. Did you just remove it?
|
Yes:
|
I'm not convinced that test_doctest2 is useless. It calls """...
We include some (random) encoded (utf-8) text in the text surrounding
the example. It should be ignored:
ЉЊЈЁЂ
"""It runs tests in verbose mode instead of running them in quiet mode:
Even we agree that test_doctest2 is useless, I would prefer to not include this silent removal in the middle of such huge refactoring (move all tests code). Please add back test_doctest2.py in the new test_doctest/ directory. |
…t/test_doctest/` (pythonGH-112109) (cherry picked from commit 9c93350) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Brett Cannon <brett@python.org>
|
GH-114254 is a backport of this pull request to the 3.12 branch. |
|
Sorry, @sobolevn and @vstinner, I could not cleanly backport this to |
|
Merged, thanks. @sobolevn: The automated backport to 3.11 failed, do you want to attempt to backport the change to 3.11 manually? |
|
Sure thing! |
|
FYI this broke the WASI builds; https://buildbot.python.org/all/#/builders/1046/builds/4033 and https://buildbot.python.org/all/#/builders/1124/builds/623 . |
…les and tests to `Lib/test/test_doctest/` (python#112109)" This reverts commit 9c93350.
…lated files and tests to `Lib/test/test_doctest/` (python#112109)"" This reverts commit c3701e9.
|
|
GH-114313 is a backport of this pull request to the 3.11 branch. |
…t/test_doctest/` (python#112109) Co-authored-by: Brett Cannon <brett@python.org>
…t/test_doctest/` (python#112109) Co-authored-by: Brett Cannon <brett@python.org>
…t/test_doctest/` (python#112109) Co-authored-by: Brett Cannon <brett@python.org>
Uh oh!
There was an error while loading. Please reload this page.