msg93566 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-04 23:08 |
One of the failures when regrtest is run with a read-only Lib results from test_runpy modifying sys.argv. Antoine also found cases where tests modified os.environ in issue 7055. It seems useful to have regrtest fix these kinds of environment corruptions when it can, but to also issue warnings so that the tests in questions can be fixed. In some cases the warnings might also reveal bugs in the code being tested, if the code being tested does a modification it should not be doing. Attached is a patch that adds save/restore for os.environ and sys.argv, with warning messages. |
|
|
msg93567 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-05 00:05 |
Or should regrtest convert these into test failures for reporting purposes? |
|
|
msg93607 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2009-10-05 16:05 |
Apart from the comments I made on IRC, I think it would be nice to have this patch in 2.6 and 3.1 as well. While not technically a bug fix, it is innocuous for users and certainly helps finding problems. |
|
|
msg93608 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-05 16:07 |
Updated patch based on Antoine's feedback on IRC. Removes a mislaid 'not quiet' and restores argv using argv[:] = saved_argv. I agree about putting it into 2.6/3.1. We could also claim that it is fixing a bug in the running of the tests :) I suspect it might make the buildbots more stable, for example. |
|
|
msg93730 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-07 23:58 |
Committed to trunk in r75255, py3k in r75279, and 3.1 in r75280. Leaving open until 2.6 is unfrozen and I can commit it there as well. |
|
|
msg93732 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2009-10-08 01:11 |
The cwd should also be checked/restored to avoid problems like #7066. |
|
|
msg93880 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-11 22:49 |
I've refactored the code and added more checks (cwd, all three stdio attributes). Patch attached. I'm not done with this because I want to make the reporting more visible. |
|
|
msg93885 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-12 01:26 |
Here is a finished version of the refactoring patch. It introduces a new category in the list of test statuses at in the summary to list the tests that have changed the execution environment. This patch makes it easy to add additional things to check and restore, and I've added 'sys.path' checking. |
|
|
msg93982 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-14 13:25 |
Here is an updated patch that doesn't break -j. |
|
|
msg93983 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2009-10-14 13:33 |
Looks good to me. Not sure it should be backported though, the patch has become really sizeable. |
|
|
msg93984 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-14 13:36 |
I agree about not backporting the new patch. |
|
|
msg94588 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2009-10-27 23:31 |
Enhanced patch applied in r75400, and further enhanced by Nick Coghlan in r75456, r75457, and r75466. Ported to py3k by Nick in r75493, with a little cleanup in r75504. |
|
|