msg127608 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2011-01-31 15:55 |
Inspired by what happened in issue 8973, I offer the attached patch for test__all__ to have it check the __all__ list for duplicates. Interestingly, the first failure is not in struct, but in os. Obviously the patch can't be applied until the test succeeds, so I'll be coming back to this later. Figured I'd post the test patch in case anyone else wants to play with fixing things before I get to it. |
|
|
msg127613 - (view) |
Author: Alexander Belopolsky (belopolsky) *  |
Date: 2011-01-31 16:27 |
+1. This is a fairly common mistake. Usually benign, but as issue 8973 shows, may highlight a visible error. |
|
|
msg127621 - (view) |
Author: SilentGhost (SilentGhost) *  |
Date: 2011-01-31 17:00 |
At the moment test fails only for os module on windows. These are the offending names: putenv, spawnv, spawnve The reason is that __all__ is extended with ntpath.__all__ and then again in the body of os.py (I'm not entirely sure how this could be fixed elegantly). |
|
|
msg127622 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2011-01-31 17:09 |
Well, the test stops testing after the first failure. Perhaps another enhancement request would be to make test__all__ a parameterized test so that it tests all modules even if one or more fail. On linux, the dups are putenv and unsetenv. And yes, deeper investigation of why os.py is adding them is required to fix this :) |
|
|
msg127623 - (view) |
Author: Alexander Belopolsky (belopolsky) *  |
Date: 2011-01-31 17:15 |
On Mon, Jan 31, 2011 at 12:09 PM, R. David Murray <report@bugs.python.org> wrote: .. > On linux, the dups are putenv and unsetenv. And yes, deeper investigation of why > os.py is adding them is required to fix this :) Too bad __all__ cannot be specified as a set. |
|
|
msg127624 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2011-01-31 17:18 |
Well, checking if the token is there before adding it would certainly be a fix, but I think it would be worth understanding why it gets added if it is already there, because instead perhaps it is possible to simply remove the adding code from os.py. Removing code is nice. |
|
|
msg187331 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2013-04-19 02:27 |
Attached an updated patch that also uses subtests to keep running all tests even in case of failure. The patch also intentionally breaks a few __all__ to show how it works -- these changes should clearly be removed once the patch gets committed. |
|
|
msg188211 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2013-05-01 11:58 |
New changeset 3f1bcfbed022 by Ezio Melotti in branch 'default': #11078: test___all__ now checks for duplicates in __all__. Initial patch by R. David Murray. http://hg.python.org/cpython/rev/3f1bcfbed022 |
|
|