[Python-checkins] r61484 - in python/trunk: Lib/test/output Lib/test/regrtest.py Misc/NEWS

brett.cannon python-checkins at python.org
Tue Mar 18 05:16:07 CET 2008


Author: brett.cannon
Date: Tue Mar 18 05:16:06 2008
New Revision: 61484

Removed:
   python/trunk/Lib/test/output/
Modified:
   python/trunk/Lib/test/regrtest.py
   python/trunk/Misc/NEWS
Log:
The output directory for tests that compare against stdout is now gone!


Modified: python/trunk/Lib/test/regrtest.py
==============================================================================
--- python/trunk/Lib/test/regrtest.py	(original)
+++ python/trunk/Lib/test/regrtest.py	Tue Mar 18 05:16:06 2008
@@ -11,7 +11,6 @@
 -v: verbose    -- run tests in verbose mode with output to stdout
 -w: verbose2   -- re-run failed tests in verbose mode
 -q: quiet      -- don't print anything except if a test fails
--g: generate   -- write the output file for a test instead of comparing it
 -x: exclude    -- arguments are tests to *exclude*
 -s: single     -- run only a single test (see below)
 -r: random     -- randomize test execution order
@@ -206,8 +205,8 @@
     test_support.record_original_stdout(sys.stdout)
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:',
-                                   ['help', 'verbose', 'quiet', 'generate',
-                                    'exclude', 'single', 'random', 'fromfile',
+                                   ['help', 'verbose', 'quiet', 'exclude',
+                                    'single', 'random', 'fromfile',
                                     'findleaks', 'use=', 'threshold=', 'trace',
                                     'coverdir=', 'nocoverdir', 'runleaks',
                                     'huntrleaks=', 'verbose2', 'memlimit=',
@@ -228,8 +227,6 @@
         elif o in ('-q', '--quiet'):
             quiet = True;
             verbose = 0
-        elif o in ('-g', '--generate'):
-            generate = True
         elif o in ('-x', '--exclude'):
             exclude = True
         elif o in ('-s', '--single'):
@@ -285,8 +282,6 @@
                         use_resources.remove(r)
                 elif r not in use_resources:
                     use_resources.append(r)
-    if generate and verbose:
-        usage(2, "-g and -v don't go together!")
     if single and fromfile:
         usage(2, "-s and -f don't go together!")
 
@@ -404,9 +399,6 @@
         if not bad and not skipped and len(good) > 1:
             print "All",
         print count(len(good), "test"), "OK."
-        if verbose:
-            print "CAUTION:  stdout isn't compared in verbose mode:"
-            print "a test that passes in verbose mode may fail without it."
     if bad:
         print count(len(bad), "test"), "failed:"
         printlist(bad)
@@ -504,8 +496,6 @@
     """Run a single test.
 
     test -- the name of the test
-    generate -- if true, generate output, instead of running the test
-                and comparing it to a previously created output file
     verbose -- if true, print more messages
     quiet -- if true, don't print 'skipped' messages (probably redundant)
     testdir -- test directory
@@ -529,8 +519,6 @@
     test_support.unload(test)
     if not testdir:
         testdir = findtestdir()
-    outputdir = os.path.join(testdir, "output")
-    outputfile = os.path.join(outputdir, test)
     if verbose:
         cfp = None
     else:
@@ -587,27 +575,7 @@
         if not cfp:
             return 1
         output = cfp.getvalue()
-        if generate:
-            if output == test + "\n":
-                if os.path.exists(outputfile):
-                    # Write it since it already exists (and the contents
-                    # may have changed), but let the user know it isn't
-                    # needed:
-                    print "output file", outputfile, \
-                          "is no longer needed; consider removing it"
-                else:
-                    # We don't need it, so don't create it.
-                    return 1
-            fp = open(outputfile, "w")
-            fp.write(output)
-            fp.close()
-            return 1
-        if os.path.exists(outputfile):
-            fp = open(outputfile, "r")
-            expected = fp.read()
-            fp.close()
-        else:
-            expected = test + "\n"
+        expected = test + "\n"
         if output == expected or huntrleaks:
             return 1
         print "test", test, "produced unexpected output:"

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Mar 18 05:16:06 2008
@@ -78,6 +78,8 @@
 Tests
 -----
 
+- Output comparison tests are no longer supported.
+
 - Rewrite test_errno to use unittest and no longer be a no-op.
 
 - GHOP 234: Convert test_extcall to doctest.


More information about the Python-checkins mailing list