summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-10-27 23:12:01 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-10-27 23:12:01 (GMT)
commitc7c71ff87cf4e8083aaae9564d2f1785f36fd3dc (patch)
treea0a94a9aca7306448297d3a5afedc4e6cec6190e /Lib/distutils/tests
parent70ec8ee2ed718de3ce3c6b47238cc6e688b87f7c (diff)
downloadcpython-c7c71ff87cf4e8083aaae9564d2f1785f36fd3dc.zip
cpython-c7c71ff87cf4e8083aaae9564d2f1785f36fd3dc.tar.gz
cpython-c7c71ff87cf4e8083aaae9564d2f1785f36fd3dc.tar.bz2
Merged revisions 75893 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75893 | tarek.ziade | 2009-10-28 00:06:10 +0100 (Wed, 28 Oct 2009) | 1 line Fixed #1180: Option to ignore ~/.pydistutils.cfg in Distutils ........
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r--Lib/distutils/tests/test_dist.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index be1010c..b1b184e 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -37,7 +37,8 @@ class TestDistribution(Distribution):
return self._config_files
-class DistributionTestCase(support.LoggingSilencer,
+class DistributionTestCase(support.TempdirManager,
+ support.LoggingSilencer,
support.EnvironGuard,
unittest.TestCase):
@@ -180,6 +181,35 @@ class DistributionTestCase(support.LoggingSilencer,
kwargs = {'level': 'ok2'}
self.assertRaises(ValueError, dist.announce, args, kwargs)
+ def test_find_config_files_disable(self):
+ # Ticket #1180: Allow user to disable their home config file.
+ temp_home = self.mkdtemp()
+ if os.name == 'posix':
+ user_filename = os.path.join(temp_home, ".pydistutils.cfg")
+ else:
+ user_filename = os.path.join(temp_home, "pydistutils.cfg")
+
+ with open(user_filename, 'w') as f:
+ f.write('[distutils]\n')
+
+ def _expander(path):
+ return temp_home
+
+ old_expander = os.path.expanduser
+ os.path.expanduser = _expander
+ try:
+ d = distutils.dist.Distribution()
+ all_files = d.find_config_files()
+
+ d = distutils.dist.Distribution(attrs={'script_args':
+ ['--no-user-cfg']})
+ files = d.find_config_files()
+ finally:
+ os.path.expanduser = old_expander
+
+ # make sure --no-user-cfg disables the user cfg file
+ self.assertEquals(len(all_files)-1, len(files))
+
class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
unittest.TestCase):