Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
9a2730fe
Commit
9a2730fe
authored
Jul 04, 2011
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ERP5TypeTestSuite helper classes.
One for automated test lookup. One for --save/--load support.
parent
759fcd8f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
2 deletions
+78
-2
product/ERP5Type/tests/ERP5TypeTestSuite.py
product/ERP5Type/tests/ERP5TypeTestSuite.py
+76
-1
product/ERP5Type/tests/runTestSuite.py
product/ERP5Type/tests/runTestSuite.py
+2
-1
No files found.
product/ERP5Type/tests/ERP5TypeTestSuite.py
View file @
9a2730fe
import
re
,
imp
,
sys
,
threading
,
os
,
shlex
,
subprocess
,
shutil
import
re
,
imp
,
sys
,
threading
,
os
,
shlex
,
subprocess
,
shutil
,
glob
,
random
import
traceback
import
traceback
# The content of this file might be partially moved to an egg
# The content of this file might be partially moved to an egg
...
@@ -230,6 +230,81 @@ class ERP5TypeTestSuite(TestSuite):
...
@@ -230,6 +230,81 @@ class ERP5TypeTestSuite(TestSuite):
+int(groupdict['
unexpected_successes
'] or 0))
+int(groupdict['
unexpected_successes
'] or 0))
return status_dict
return status_dict
class ProjectTestSuite(ERP5TypeTestSuite):
"""
Helper code to locate all tests in a path list.
To use this class, inherit from it and define the following properties:
_product_list
List of product names to search tests in.
_bt_list
List of bt names to search tests in.
_search_path_list:
List of base paths to search for products & bts.
Defaults to sys.path (upon getTestList execution).
"""
_product_list = ()
_bt_list = ()
_search_path_list = None
def _searchDirectory(path, path_list):
"""
Returns a iterator over directories matching <path> inside directories
given in <path list>.
"""
path = os.path
pjoin = path.join
isdir = path.isdir
return (y for y in (pjoin(x, path) for x in path_list) if isdir(y))
def getTestList(self):
_glob = glob.glob
path = os.path
pjoin = path.join
path_list = self._search_path_list or sys.path
product_test_file_glob = pjoin('
tests
', '
test
*
.
py
')
bt_test_file_glob = pjoin('
TestTemplateItem
', '
test
*
.
py
')
test_file_list = []
extend = test_file_list.extend
for product_dir in self._searchDirectory('
product
', path_list):
for product_id in self._product_list:
extend(_glob(pjoin(product_dir, product_id, product_test_file_glob)))
for bt_dir in self._searchDirectory('
bt5
', path_list):
for bt_id in self._bt_list:
extend(_glob(pjoin(bt_dir, bt_id, bt_test_file_glob)))
return [path.splitext(path.basename(name))[0]
for name in test_file_list]
class SavedProjectTestSuite(ERP5TypeTestSuite):
"""
Helper code to use --save/--load to reduce execution time.
To use this class, inherit from it and define the following properties:
_saved_test_id
Name of the test to use for --save execution.
"""
_saved_test_id = None
def __init__(self, *args, **kw):
# Use same portal id for all tests run by current instance
# but keep it (per-run) random.
self._portal_id = '
portal_
%
i
' % (random.randint(0, sys.maxint), )
super(SavedProjectTestSuite, self).__init__(*args, **kw)
def __runUnitTest(self, *args, **kw):
return super(SavedProjectTestSuite, self).runUnitTest(
'
--
portal_id
=
' + self._portal_id,
*args, **kw)
def runUnitTest(self, *args, **kw):
return self.__runUnitTest(
'
--
load
',
*args, **kw)
def setup(self):
super(SavedProjectTestSuite, self).setup()
self.__runUnitTest('
--
save
', self._saved_test_id)
class SubprocessError(EnvironmentError):
class SubprocessError(EnvironmentError):
def __init__(self, status_dict):
def __init__(self, status_dict):
self.status_dict = status_dict
self.status_dict = status_dict
...
...
product/ERP5Type/tests/runTestSuite.py
View file @
9a2730fe
#!/usr/bin/python2.6
#!/usr/bin/python2.6
import
argparse
,
pprint
,
socket
,
sys
,
time
,
xmlrpclib
import
argparse
,
pprint
,
socket
,
sys
,
time
,
xmlrpclib
from
DummyTaskDistributionTool
import
DummyTaskDistributionTool
from
DummyTaskDistributionTool
import
DummyTaskDistributionTool
from
ERP5TypeTestSuite
import
ERP5TypeTestSuite
from
ERP5TypeTestSuite
import
ERP5TypeTestSuite
,
SavedProjectTestSuite
,
\
ProjectTestSuite
def
makeSuite
(
node_quantity
=
None
,
test_suite
=
None
,
revision
=
None
,
def
makeSuite
(
node_quantity
=
None
,
test_suite
=
None
,
revision
=
None
,
db_list
=
None
):
db_list
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment