gh-75723: Idempotent .pth execution in site.addsitedir#147951
gh-75723: Idempotent .pth execution in site.addsitedir#147951asottile wants to merge 2 commits intopython:mainfrom
.pth execution in site.addsitedir#147951Conversation
|
Do you have any ideas how to explain the test failure? cpython/Lib/test/test_xmlrpc.py Lines 479 to 489 in 4810bed |
|
🤖 New build scheduled with the buildbot fleet by @FFY00 for commit 6c342df 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F147951%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
The |
|
Well, the test is still failing. It seems like the I am gonna sync with main, just to be sure this is not a known issue. |
FFY00
left a comment
There was a problem hiding this comment.
This looks okay, overall. There is just the test_xmlrpc failure we need to fix, and the news text that should be updated.
| @@ -0,0 +1 @@ | |||
| Idempotent ``.pth`` file exection in :meth:`site.addsitedir`. | |||
There was a problem hiding this comment.
Please re-write this to be more descriptive (eg. "Avoid re-executing .pth files when site.addsitedir is called for for a known directory")
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
@FFY00 After looking into the code for a bit, this is the best test refinement I have come up with: def test_default(self):
# Patch BOTH time and localtime inside the client module
with mock.patch('xmlrpc.client.time.time') as time_mock, \
mock.patch('xmlrpc.client.time.localtime') as localtime_mock:
# 1. Force the 'current' time to be a specific float
time_mock.return_value = 1373847889.0
# 2. Force the conversion to be your specific struct
time_struct = time.struct_time([2013, 7, 15, 0, 24, 49, 0, 196, 0])
localtime_mock.return_value = time_struct
t = xmlrpclib.DateTime()
self.assertEqual(str(t), "20130715T00:24:49") |
Uh oh!
There was an error while loading. Please reload this page.