Skip to content

bpo-34182: Fix test_pydoc running as a script#8389

Merged
serhiy-storchaka merged 3 commits into
python:masterfrom
bbayles:pydoc-test-34182
Jul 29, 2018
Merged

bpo-34182: Fix test_pydoc running as a script#8389
serhiy-storchaka merged 3 commits into
python:masterfrom
bbayles:pydoc-test-34182

Conversation

@bbayles

@bbayles bbayles commented Jul 22, 2018

Copy link
Copy Markdown
Contributor

This PR fixes running test_pydoc as a module. The issue was that this line was returning Lib instead of /path/to/Lib.

$ ./python Lib/test/test_pydoc.py 
...
test_mixed_case_module_names_are_lower_cased (__main__.PydocDocTest) ... ok
...

----------------------------------------------------------------------
Ran 53 tests in 3.177s

OK (skipped=3)

https://bugs.python.org/issue34182

@serhiy-storchaka

Copy link
Copy Markdown
Member

Running the test with the following command line still failed.

$ ./python Lib/test/./test_pydoc.py

@bbayles

bbayles commented Jul 22, 2018

Copy link
Copy Markdown
Contributor Author

OK, I moved the abspath call to fix that.

Comment thread Lib/test/test_pydoc.py Outdated
abspath = os.path.abspath
dirname = os.path.dirname
basedir = dirname(dirname(__file__))
basedir = (dirname(dirname(abspath(__file__))))

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.

Redundant parenthesis.

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @bbayles for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 29, 2018
(cherry picked from commit 4e11c46)

Co-authored-by: Bo Bayles <bbayles@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

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

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @bbayles and @serhiy-storchaka, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 4e11c461ed39085b8495a35c9367b46d8a0d306d 3.6

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @bbayles and @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 4e11c461ed39085b8495a35c9367b46d8a0d306d 2.7

@bbayles

bbayles commented Jul 29, 2018

Copy link
Copy Markdown
Contributor Author

I don't think the backport is necessary for 3.6 or 2.7. They both use os.path.realpath, which avoids the issue here.

The issue was introduced in ebfaa71 in 2017.

I think leaving 3.6 and 2.7 as they are leaves them vulnerable to 32031, however. Should I move this fix to those branches, or not bother?

@serhiy-storchaka

Copy link
Copy Markdown
Member

This is not very important issue in any case.

miss-islington added a commit that referenced this pull request Jul 29, 2018
(cherry picked from commit 4e11c46)

Co-authored-by: Bo Bayles <bbayles@gmail.com>
@serhiy-storchaka

Copy link
Copy Markdown
Member

Thank you for your PR!

@serhiy-storchaka serhiy-storchaka removed their assignment Oct 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants