Skip to content

bpo-36406: Handle namespace packages in doctest#12520

Merged
brettcannon merged 5 commits into
python:masterfrom
tirkarthi:bpo36406
Dec 13, 2019
Merged

bpo-36406: Handle namespace packages in doctest#12520
brettcannon merged 5 commits into
python:masterfrom
tirkarthi:bpo36406

Conversation

@tirkarthi

@tirkarthi tirkarthi commented Mar 24, 2019

Copy link
Copy Markdown
Member

Handle namespace packages in doctest where __file__ of empty package returns None

https://bugs.python.org/issue36406

@tirkarthi

Copy link
Copy Markdown
Member Author

Note to self and reviewer : I have originally added a fix to handle filename to None and finder is also documented to accept None. But the previous code seems to always default to module.__name__ where __file__ attribute was absent for empty packages previously. So I changed this to getattr(module, '__file__', module.__name__) or module.__name__ to remove check for filename to be None.

Comment thread Lib/doctest.py Outdated
@tirkarthi

Copy link
Copy Markdown
Member Author

Ping @warsaw for review. This was caused due to a23d30f where __file__ was set as None for empty packages causing doctest to fail for empty packages.

@csabella csabella added the type-bug An unexpected behavior, bug, or error label May 29, 2019
@csabella csabella requested review from brettcannon and warsaw May 29, 2019 11:49
Comment thread Lib/doctest.py Outdated
Co-Authored-By: Brett Cannon <54418+brettcannon@users.noreply.github.com>
@tirkarthi tirkarthi changed the title bpo-36406: Handle empty packages in doctest bpo-36406: Handle namespace packages in doctest Sep 11, 2019
@brettcannon brettcannon self-requested a review September 13, 2019 10:33
@brettcannon

Copy link
Copy Markdown
Member

@warsaw anything to say before this gets merged?

@tirkarthi if Barry doesn't say anything in a week just ping me and I will merge this.

@tirkarthi

Copy link
Copy Markdown
Member Author

@brettcannon Ping for merge. Thanks.

@brettcannon brettcannon self-assigned this Dec 10, 2019
@brettcannon

Copy link
Copy Markdown
Member

@tirkarthi thanks for the ping. I will merge this probably this week or next when I have the time.

@brettcannon brettcannon merged commit 8289e27 into python:master Dec 13, 2019
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @tirkarthi for the PR, and @brettcannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 13, 2019
(cherry picked from commit 8289e27)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-17591 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 13, 2019
(cherry picked from commit 8289e27)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-17592 is a backport of this pull request to the 3.7 branch.

brettcannon pushed a commit that referenced this pull request Dec 13, 2019
(cherry picked from commit 8289e27)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
brettcannon pushed a commit that referenced this pull request Dec 13, 2019
(cherry picked from commit 8289e27)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
@tirkarthi

Copy link
Copy Markdown
Member Author

Thanks @brettcannon and @methane for review :)

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants