bpo-27200: fix pathlib, ssl, turtle and weakref doctests#616
bpo-27200: fix pathlib, ssl, turtle and weakref doctests#616berkerpeksag merged 11 commits intopython:masterfrom marco-buttu:fix-issue-27200-4th
Conversation
|
@marco-buttu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @eliben, @birkenfeld, @vsajip, @tiran and @loewis to be potential reviewers. |
The setcontext(Context()) in testsetup does not guarantee that the tests outside this file have a clean context. We need to clean the context at the end of the tests.
Doc/library/decimal.rst
Outdated
|
|
||
| # make sure other tests (also outside this file) get a fresh context | ||
| setcontext(Context()) | ||
|
|
There was a problem hiding this comment.
The setcontext(Context()) in testsetup does not guarantee that the tests outside this file get a fresh context. We need to clean the context at the end of the tests.
There was a problem hiding this comment.
Please leave decimal.rst changes out of this PR and open a separate PR and then ping Stefan Krah.
berkerpeksag
left a comment
There was a problem hiding this comment.
I think we also need to following change to ssl examples:
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index 01dbecd..02a0c79 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -2262,7 +2262,7 @@ SSL versions 2 and 3 are considered insecure and are therefore dangerous to
use. If you want maximum compatibility between clients and servers, it is
recommended to use :const:`PROTOCOL_TLS_CLIENT` or
:const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are
-disabled by default.
+disabled by default. ::
>>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
>>> client_context.options |= ssl.OP_NO_TLSv1And there are the other failures:
**********************************************************************
File "library/ssl.rst", line 421, in newcontext
Failed example:
timestamp
Expected:
1515144883
Got:
1515134083.0
**********************************************************************
File "library/ssl.rst", line 424, in newcontext
Failed example:
print(datetime.utcfromtimestamp(timestamp))
Expected:
2018-01-05 09:34:43
Got:
2018-01-05 06:34:43
Doc/library/decimal.rst
Outdated
|
|
||
| # make sure other tests (also outside this file) get a fresh context | ||
| setcontext(Context()) | ||
|
|
There was a problem hiding this comment.
Please leave decimal.rst changes out of this PR and open a separate PR and then ping Stefan Krah.
Doc/library/shlex.rst
Outdated
| cases where you cannot use a list. | ||
|
|
||
| This idiom would be unsafe:: | ||
| This idiom would be unsafe: |
Doc/library/pathlib.rst
Outdated
| --------- | ||
|
|
||
| Importing the main class:: | ||
| Importing the main class: |
There was a problem hiding this comment.
Please revert this change. The current version looks correct to me and the tests passed when I revert it to use ::.
|
Thank you very much for your time @berkerpeksag! I made all changes you requested me. Just one question: you got a |
|
I don't know, it's probably worth doing some VCS archaeology :) I built and ran tests in Python 3.4 with an ancient OpenSSL so this might be the culprit. |
Doc/library/ssl.rst
Outdated
| recommended to use :const:`PROTOCOL_TLS_CLIENT` or | ||
| :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are | ||
| disabled by default. | ||
| disabled by default. :: |
There was a problem hiding this comment.
I know I suggested this style in my earlier comment, but could you move :: to a new line so we don't lose git blame information? This also applies to the changes in Doc/library/pathlib.rst.
There was a problem hiding this comment.
Ok, done :-) Thanks againt @berkerpeksag
|
Thanks! |
This PR is the last but one in the series bpo-27200. The first one was #240, the second one #401, and the third #604. To run the doctests (from the
Docdirectory):