Skip to content

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

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

Merged
merged 3 commits into from
Jul 29, 2018

Conversation

bbayles
Copy link
Contributor

@bbayles bbayles commented Jul 22, 2018

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
Member

Running the test with the following command line still failed.

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

@bbayles
Copy link
Contributor Author

bbayles commented Jul 22, 2018

OK, I moved the abspath call to fix that.

dirname = os.path.dirname
basedir = dirname(dirname(__file__))
basedir = (dirname(dirname(abspath(__file__))))
Copy link
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
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
@bedevere-bot
Copy link

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

@miss-islington
Copy link
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
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
Copy link
Contributor Author

bbayles commented Jul 29, 2018

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
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 <[email protected]>
@serhiy-storchaka
Copy link
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