[Python-checkins] distutils2: make sure unittest2 is present

tarek.ziade python-checkins at python.org
Fri May 14 22:36:12 CEST 2010


tarek.ziade pushed c7c0e2ee9376 to distutils2:

http://hg.python.org/distutils2/rev/c7c0e2ee9376
changeset:   144:c7c0e2ee9376
user:        Tarek Ziade <tarek at ziade.org>
date:        Wed May 12 17:44:26 2010 +0200
summary:     make sure unittest2 is present
files:       src/runtests.py

diff --git a/src/runtests.py b/src/runtests.py
--- a/src/runtests.py
+++ b/src/runtests.py
@@ -3,11 +3,11 @@
 The tests for distutils2 are defined in the distutils2.tests package;
 """
 import sys
-import distutils2.tests
-from distutils2.tests import run_unittest, reap_children
-from distutils2._backport.tests import test_suite as btest_suite
 
 def test_main():
+    import distutils2.tests
+    from distutils2.tests import run_unittest, reap_children
+    from distutils2._backport.tests import test_suite as btest_suite
     # just supporting -q right now
     # to enable detailed/quiet output
     if len(sys.argv) > 1:
@@ -20,4 +20,10 @@
     reap_children()
 
 if __name__ == "__main__":
+    try:
+        import unittest2
+    except ImportError:
+        print('!!! You need to install unittest2')
+        sys.exit(1)
+
     test_main()

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list