[Python-checkins] distutils2: add assertIsFile
tarek.ziade
python-checkins at python.org
Sun Jan 30 10:43:58 CET 2011
tarek.ziade pushed c7deaaa88de8 to distutils2:
http://hg.python.org/distutils2/rev/c7deaaa88de8
changeset: 944:c7deaaa88de8
parent: 913:317bff9e4495
user: Gael Pasgrimaud <gael at gawel.org>
date: Sat Jan 29 16:05:20 2011 +0100
summary:
add assertIsFile
files:
distutils2/tests/support.py
diff --git a/distutils2/tests/support.py b/distutils2/tests/support.py
--- a/distutils2/tests/support.py
+++ b/distutils2/tests/support.py
@@ -155,6 +155,18 @@
dist = Distribution(attrs=kw)
return pkg_dir, dist
+ def assertIsFile(self, *args):
+ path = os.path.join(*args)
+ dirname = os.path.dirname(path)
+ file = os.path.basename(path)
+ if os.path.isdir(dirname):
+ files = os.listdir(dirname)
+ msg = "%s not found in %s: %s" % (file, dirname, files)
+ assert os.path.isfile(path), msg
+ else:
+ raise AssertionError(
+ '%s not found. %s does not exist' % (file, dirname))
+
class EnvironGuard(object):
"""TestCase-compatible mixin to save and restore the environment."""
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list