[Python-checkins] distutils2: added a test for bad options to Distribution()
tarek.ziade
python-checkins at python.org
Sun Aug 8 11:50:47 CEST 2010
tarek.ziade pushed 11a1f110d6c2 to distutils2:
http://hg.python.org/distutils2/rev/11a1f110d6c2
changeset: 482:11a1f110d6c2
user: Yannick Gingras <ygingras at ygingras.net>
date: Fri Jul 30 00:52:53 2010 -0400
summary: added a test for bad options to Distribution()
files: src/distutils2/tests/test_dist.py
diff --git a/src/distutils2/tests/test_dist.py b/src/distutils2/tests/test_dist.py
--- a/src/distutils2/tests/test_dist.py
+++ b/src/distutils2/tests/test_dist.py
@@ -153,6 +153,27 @@
my_file2 = os.path.join(tmp_dir, 'f2')
dist.metadata.write_file(open(my_file, 'w'))
+ def test_bad_attr(self):
+ cls = Distribution
+
+ # catching warnings
+ warns = []
+ def _warn(msg):
+ warns.append(msg)
+
+ old_warn = warnings.warn
+ warnings.warn = _warn
+ try:
+ dist = cls(attrs={'author': 'xxx',
+ 'name': 'xxx',
+ 'version': 'xxx',
+ 'url': 'xxxx',
+ 'badoptname': 'xxx'})
+ finally:
+ warnings.warn = old_warn
+
+ self.assertTrue(len(warns)==1 and "Unknown distribution" in warns[0])
+
def test_empty_options(self):
# an empty options dictionary should not stay in the
# list of attributes
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list