[issue1180] Option to ignore or substitute ~/.pydistutils.cfg
Phillip J. Eby
report at bugs.python.org
Sun Apr 27 20:25:44 CEST 2008
Phillip J. Eby <pje at telecommunity.com> added the comment:
I much prefer the simpler of the two patches - better to monkeypatch in
the tests than adding complications to the already over-complicated
distutils.dist. I don't find monkeypatching in tests to be horrible at
all, but if it really bothers you, just create a temporary directory for
HOME to point to, and test a Distribution subclass with an overridden
By the way, the patch could be simpler if you just made the "if 'HOME'
in os.environ" read "if not self.no_user_cfg and 'HOME' in os.environ",
rather than reworking the entire code region. On the other hand, if
you'd rather have ultra-clean unit tests, you could split the
functionality of find_config_files() into two methods: one that creates
the candidate list and the other that filters it by existence.
Personally, my vote is to keep the monkeypatching in the tests and make
the barest minimal changes to the Distribution class though.
Tracker <report at bugs.python.org>
More information about the Python-bugs-list