Commit 37bd7245 authored by Romain Courteaud's avatar Romain Courteaud

Do not propage parameter by saving class attribute. Update API and save

parameter on class's instance instead.
This will prevent 2 class instances to run in the same environnment.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41875 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c862d150
...@@ -467,11 +467,11 @@ def runLiveTest(test_list, verbosity=1, stream=None, **kw): ...@@ -467,11 +467,11 @@ def runLiveTest(test_list, verbosity=1, stream=None, **kw):
result = super(DebugTextTestRunner, self)._makeResult() result = super(DebugTextTestRunner, self)._makeResult()
return DebugTestResult(result) return DebugTestResult(result)
TestRunner = DebugTextTestRunner TestRunner = DebugTextTestRunner
loader = ERP5TypeTestLoader()
run_only = kw.get('run_only', None) run_only = kw.get('run_only', None)
if run_only is not None: if run_only is not None:
ERP5TypeTestLoader.filter_test_list = [re.compile(x).search loader.filter_test_list = [re.compile(x).search for x in run_only.split(',')]
for x in run_only.split(',')] suite = loader.loadTestsFromNames(test_list)
suite = ERP5TypeTestLoader().loadTestsFromNames(test_list)
output = stream output = stream
if stream is None: if stream is None:
output = StringIO() output = StringIO()
......
...@@ -347,7 +347,7 @@ class DebugTestResult: ...@@ -347,7 +347,7 @@ class DebugTestResult:
_print = sys.stderr.write _print = sys.stderr.write
def runUnitTestList(test_list, verbosity=1, debug=0): def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
if "zeo_client" in os.environ and "zeo_server" in os.environ: if "zeo_client" in os.environ and "zeo_server" in os.environ:
_print("conflicting options: --zeo_client and --zeo_server") _print("conflicting options: --zeo_client and --zeo_server")
sys.exit(1) sys.exit(1)
...@@ -506,7 +506,12 @@ def runUnitTestList(test_list, verbosity=1, debug=0): ...@@ -506,7 +506,12 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
result = super(DebugTextTestRunner, self)._makeResult() result = super(DebugTextTestRunner, self)._makeResult()
return DebugTestResult(result) return DebugTestResult(result)
TestRunner = DebugTextTestRunner TestRunner = DebugTextTestRunner
suite = ERP5TypeTestLoader().loadTestsFromNames(test_list) loader = ERP5TypeTestLoader()
if run_only:
loader.filter_test_list = [re.compile(x).search for x in
run_only.split(',')]
suite = loader.loadTestsFromNames(test_list)
if not isinstance(Storage, ClientStorage): if not isinstance(Storage, ClientStorage):
# Remove nodes that were registered during previous execution. # Remove nodes that were registered during previous execution.
...@@ -617,6 +622,7 @@ def main(): ...@@ -617,6 +622,7 @@ def main():
os.environ["erp5_tests_recreate_catalog"] = "0" os.environ["erp5_tests_recreate_catalog"] = "0"
verbosity = 1 verbosity = 1
debug = 0 debug = 0
run_only = None
instance_home = os.path.join(real_instance_home, 'unit_test') instance_home = os.path.join(real_instance_home, 'unit_test')
for opt, arg in opts: for opt, arg in opts:
...@@ -663,8 +669,7 @@ def main(): ...@@ -663,8 +669,7 @@ def main():
elif opt == "--erp5_catalog_storage": elif opt == "--erp5_catalog_storage":
os.environ["erp5_catalog_storage"] = arg os.environ["erp5_catalog_storage"] = arg
elif opt == "--run_only": elif opt == "--run_only":
ERP5TypeTestLoader.filter_test_list = [re.compile(x).search run_only = arg
for x in arg.split(',')]
elif opt == "--update_only": elif opt == "--update_only":
os.environ["update_only"] = arg os.environ["update_only"] = arg
os.environ["update_business_templates"] = "1" os.environ["update_business_templates"] = "1"
...@@ -712,7 +717,9 @@ def main(): ...@@ -712,7 +717,9 @@ def main():
result = runUnitTestList(test_list=args, result = runUnitTestList(test_list=args,
verbosity=verbosity, verbosity=verbosity,
debug=debug) debug=debug,
run_only=run_only,
)
try: try:
from Testing.ZopeTestCase import profiler from Testing.ZopeTestCase import profiler
except ImportError: except ImportError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment