From 2ba535acb1f03fb7d1bdb57e4173d55661d300da Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 3 Dec 2009 21:19:54 -0500 Subject: Added libbe.TESTING (defaults to False). This flag allows us to skip unittest and testsuite declaration if we woln't need them. It speeds up simple be calls a suprising amount. With Testing=True (the old behavior): wking@thor:be.wtk$ time ./be > /dev/null real 0m0.393s user 0m0.340s sys 0m0.048s With TESTING=False (the new behavior): be.wtk$ time ./be > /dev/null real 0m0.216s user 0m0.152s sys 0m0.064s This adjustment was inspired by Jakub Wilk's Debian bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559295 --- libbe/bug.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libbe/bug.py') diff --git a/libbe/bug.py b/libbe/bug.py index 897d841..1a190c3 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -31,8 +31,8 @@ try: # import core module, Python >= 2.5 except ImportError: # look for non-core module from elementtree import ElementTree import xml.sax.saxutils -import doctest +import libbe from beuuid import uuid_gen from properties import Property, doc_property, local_property, \ defaulting_property, checked_property, cached_property, \ @@ -41,6 +41,8 @@ import settings_object import mapfile import comment import utility +if libbe.TESTING == True: + import doctest class DiskAccessRequired (Exception): @@ -877,4 +879,5 @@ def cmp_last_modified(bug_1, bug_2): return -cmp(val_1, val_2) -suite = doctest.DocTestSuite() +if libbe.TESTING == True: + suite = doctest.DocTestSuite() -- cgit