[Checkins] SVN: zc.buildout/trunk/ Tweaks to get tests to pass accross Python 2.4, 2.5, and 2.6.

Jim Fulton jim at zope.com
Fri Aug 28 17:55:09 EDT 2009


Log message for revision 103355:
  Tweaks to get tests to pass accross Python 2.4, 2.5, and 2.6.
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/tests.py
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt

-=-
Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2009-08-28 20:30:56 UTC (rev 103354)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2009-08-28 21:55:09 UTC (rev 103355)
@@ -2893,7 +2893,11 @@
                (re.compile('extdemo[.]pyd'), 'extdemo.so'),
                (re.compile('[-d]  setuptools-\S+[.]egg'), 'setuptools.egg'),
                (re.compile(r'\\[\\]?'), '/'),
-               ]),
+               ]+(sys.version_info < (2, 5) and [
+                  (re.compile('.*No module named runpy.*', re.S), ''),
+                  (re.compile('.*usage: pdb.py scriptfile .*', re.S), ''),
+                  (re.compile('.*Error: what does not exist.*', re.S), ''),
+                  ] or [])),
             ),
 
         doctest.DocFileSuite(

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt	2009-08-28 20:30:56 UTC (rev 103354)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt	2009-08-28 21:55:09 UTC (rev 103355)
@@ -107,6 +107,7 @@
     >>> shebang == '#!' + other_executable
     True
     >>> print f.read(), # doctest: +NORMALIZE_WHITESPACE
+    <BLANKLINE>
     import sys
     <BLANKLINE>
     sys.path[0:0] = [
@@ -116,21 +117,27 @@
     <BLANKLINE>
     _interactive = True
     if len(sys.argv) > 1:
-        import getopt
-        _options, _args = getopt.getopt(sys.argv[1:], 'ic:')
+        _options, _args = __import__("getopt").getopt(sys.argv[1:], 'ic:m:')
         _interactive = False
         for (_opt, _val) in _options:
             if _opt == '-i':
                 _interactive = True
             elif _opt == '-c':
                 exec _val
+            elif _opt == '-m':
+                sys.argv[1:] = _args
+                _args = []
+                __import__("runpy").run_module(
+                     _val, {}, "__main__", alter_sys=True)
     <BLANKLINE>
         if _args:
             sys.argv[:] = _args
-            execfile(sys.argv[0])
+            __file__ = _args[0]
+            del _options, _args
+            execfile(__file__)
     <BLANKLINE>
     if _interactive:
-        import code
-        code.interact(banner="", local=globals())
+        del _interactive
+        __import__("code").interact(banner="", local=globals())
 
     >>> f.close()



More information about the checkins mailing list