[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/test.py
Collector #1895: omit 'var' folder from recursive traversal
causing trouble
Andreas Jung
andreas at andreas-jung.com
Sun Oct 2 06:28:55 EDT 2005
Log message for revision 38712:
Collector #1895: omit 'var' folder from recursive traversal causing trouble
with DirectoryStorage
Changed:
U Zope/branches/Zope-2_8-branch/test.py
-=-
Modified: Zope/branches/Zope-2_8-branch/test.py
===================================================================
--- Zope/branches/Zope-2_8-branch/test.py 2005-10-02 03:16:20 UTC (rev 38711)
+++ Zope/branches/Zope-2_8-branch/test.py 2005-10-02 10:28:54 UTC (rev 38712)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/home/fermigier/bin/python
##############################################################################
#
@@ -121,6 +121,26 @@
utility writes coverage files to a directory named `coverage' that
is parallel to `build'. It also prints a summary to stdout.
+--coverage
+ Use the coverage.py module from Gareth Rees
+ (http://www.nedbatchelder.com/code/modules/coverage.html) to collect data
+ for code coverage. This will output trace data in a file called
+ '.coverage'. You will need to call coverage.py after the test run to
+ analyse the data (-r for a line count report, -a for annotated file).
+
+--profile
+ Use the profile module from the standard library to collect profiling data.
+ This will output data in a file called '.profile'. You will need to use the
+ pstats module from the standard library after the test run to analyse the
+ data.
+
+--hotshot
+ Use the hotshot module from the standard library to collect profiling data.
+ This will output data in a file called '.hotshot'. You will need to use the
+ hotshot.pstats module from the standard library after the test run to
+ analyse the data. You may also use the hotshot2cg script from the
+ KCacheGrind sources to create data suitable for analysis by KCacheGrind.
+
-v
Verbose output. With one -v, unittest prints a dot (".") for each
test run. With -vv, unittest prints the name of each test (for
@@ -619,7 +639,7 @@
except os.error:
return
visit(arg, path, names)
- exceptions = (os.curdir, os.pardir)
+ exceptions = (os.curdir, os.pardir, 'var')
for name in names:
if name not in exceptions:
name = os.path.join(path, name)
@@ -749,6 +769,9 @@
LOOP = False
GUI = False
TRACE = False
+ COVERAGE = False
+ PROFILE = False
+ HOTSHOT = False
REFCOUNT = False
debug = False # Don't collect test results; simply let tests crash
debugger = False
@@ -771,7 +794,8 @@
opts, args = getopt.getopt(argv[1:], "a:bcC:dDfg:G:hLmprtTuv",
["all", "help", "libdir=", "times=",
"keepbytecode", "dir=",
- "config-file=", "import-testing"])
+ "config-file=", "import-testing",
+ "coverage", "profile", "hotshot"])
except getopt.error, msg:
print msg
print "Try `python %s -h' for more information." % argv[0]
@@ -823,6 +847,12 @@
print "-r ignored, because it needs a debug build of Python"
elif k == "-T":
TRACE = True
+ elif k == "--coverage":
+ COVERAGE = True
+ elif k == "--profile":
+ PROFILE = True
+ elif k == "--hotshot":
+ HOTSHOT = True
elif k == "-t":
if not timetests:
timetests = 50
@@ -903,6 +933,29 @@
globals=globals(), locals=vars())
r = tracer.results()
r.write_results(show_missing=True, summary=True, coverdir=coverdir)
+
+ elif COVERAGE:
+ try:
+ from coverage import the_coverage
+ except:
+ print "You need to install coverage.py from "
+ print "http://www.nedbatchelder.com/code/modules/coverage.html"
+ sys.exit()
+ the_coverage.start()
+ main(module_filter, test_filter, libdir)
+
+ elif PROFILE:
+ import profile
+ profile.runctx("main(module_filter, test_filter, libdir)",
+ globals=globals(), locals=vars(),
+ filename=".profile")
+
+ elif HOTSHOT:
+ import hotshot
+ profile = hotshot.Profile(".hotshot")
+ profile.runctx("main(module_filter, test_filter, libdir)",
+ globals=globals(), locals=vars())
+
else:
bad = main(module_filter, test_filter, libdir)
if bad:
More information about the Zope-Checkins
mailing list