Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
0330a7b6
Commit
0330a7b6
authored
May 09, 2012
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code to support expected failures
parent
650aa38a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
+21
-7
No files found.
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
View file @
0330a7b6
...
@@ -47,6 +47,7 @@ TEST_RESULT_RE = re.compile('<div style="padding-top: 10px;">\s*<p>\s*'
...
@@ -47,6 +47,7 @@ TEST_RESULT_RE = re.compile('<div style="padding-top: 10px;">\s*<p>\s*'
'<img.*?</div>
\
s.*?</di
v
>
\
s*
'
, re.S)
'<img.*?</div>
\
s.*?</di
v
>
\
s*
'
, re.S)
TEST_ERROR_RESULT_RE = re.compile('
.
*
(
?
:
error
.
gif
|
title
status_failed
).
*
', re.S)
TEST_ERROR_RESULT_RE = re.compile('
.
*
(
?
:
error
.
gif
|
title
status_failed
).
*
', re.S)
EXPECTED_FAILURE_RE = re.compile('
.
*
expected
failure
.
*
', re.I)
ZELENIUM_BASE_URL = "%s/portal_tests/%s/core/TestRunner.html?test=../test_suite_html&auto=on&resultsUrl=../postResults&__ac_name=%s&__ac_password=%s"
ZELENIUM_BASE_URL = "%s/portal_tests/%s/core/TestRunner.html?test=../test_suite_html&auto=on&resultsUrl=../postResults&__ac_name=%s&__ac_password=%s"
...
@@ -302,14 +303,20 @@ class FunctionalTestRunner:
...
@@ -302,14 +303,20 @@ class FunctionalTestRunner:
def processResult(self):
def processResult(self):
file_content = self.getStatus().encode("utf-8", "replace")
file_content = self.getStatus().encode("utf-8", "replace")
sucess_amount =
TEST_PASS_RE.search(file_content).group(1
)
sucess_amount =
int(TEST_PASS_RE.search(file_content).group(1)
)
failure_amount =
TEST_FAILURE_RE.search(file_content).group(1
)
failure_amount =
int(TEST_FAILURE_RE.search(file_content).group(1)
)
error_title_list = [re.compile('
\
s+
'
).sub(' ', x).strip()
error_title_list = [re.compile('
\
s+
'
).sub(' ', x).strip()
for x in TEST_ERROR_TITLE_RE.findall(file_content)]
for x in TEST_ERROR_TITLE_RE.findall(file_content)]
is_expected_failure = lambda x: EXPECTED_FAILURE_RE.match(x)
expected_failure_amount = len(filter(is_expected_failure, error_title_list))
# Remove expected failures from list
error_title_list = filter(lambda x: not is_expected_failure(x), error_title_list)
failure_amount -= expected_failure_amount
detail = ''
detail = ''
for test_result in TEST_RESULT_RE.findall(file_content):
for test_result in TEST_RESULT_RE.findall(file_content):
if
TEST_ERROR_RESULT_RE.match(test_result):
if TEST_ERROR_RESULT_RE.match(test_result):
detail += test_result
detail += test_result
detail = IMAGE_RE.sub('', detail)
detail = IMAGE_RE.sub('', detail)
...
@@ -323,7 +330,8 @@ class FunctionalTestRunner:
...
@@ -323,7 +330,8 @@ class FunctionalTestRunner:
</html>''' % detail
</html>''' % detail
# When return fix output for handle unicode issues.
# When return fix output for handle unicode issues.
return detail, int(sucess_amount), int(failure_amount), error_title_list
return detail, sucess_amount, failure_amount, expected_failure_amount,
\
error_title_list
class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
run_only = ""
run_only = ""
...
@@ -382,7 +390,8 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
...
@@ -382,7 +390,8 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
debug = self.foreground or os.environ.get("erp5_debug_mode")
debug = self.foreground or os.environ.get("erp5_debug_mode")
self.runner.test(debug=debug)
self.runner.test(debug=debug)
try:
try:
detail, success, failure, error_title_list = self.runner.processResult()
detail, success, failure,
\
expected_failure, error_title_list = self.runner.processResult()
except TimeoutError, e:
except TimeoutError, e:
self._verboseErrorLog(20)
self._verboseErrorLog(20)
raise TimeoutError(e)
raise TimeoutError(e)
...
@@ -394,8 +403,13 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
...
@@ -394,8 +403,13 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
self.logMessage("-" * 79)
self.logMessage("-" * 79)
total = success + failure
total = success + failure
self.logMessage("%s Functional Tests %s Tests, %s Failures" %
\
message_args = {"title": self.getTitle(),
(self.getTitle(), total, failure))
"total": total,
"failure": failure,
"expected": expected_failure}
message = "%(title)s Functional Tests %(total)s Tests, %(failure)s " +
\
"Failures, %(expected)s Expected failures"
self.logMessage(message % message_args)
self.logMessage("-" * 79)
self.logMessage("-" * 79)
self.logMessage(detail)
self.logMessage(detail)
self.logMessage("-" * 79)
self.logMessage("-" * 79)
...
...
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