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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
5f4859aa
Commit
5f4859aa
authored
Jun 20, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: fix text formatting of results on Python 2.7
parent
3a862986
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
30 deletions
+23
-30
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+0
-7
product/ERP5Type/tests/backportUnittest.py
product/ERP5Type/tests/backportUnittest.py
+23
-23
No files found.
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
5f4859aa
...
@@ -226,13 +226,6 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
...
@@ -226,13 +226,6 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
ZopeTestCase
.
_print
(
'All tests are skipped when --save option is passed '
ZopeTestCase
.
_print
(
'All tests are skipped when --save option is passed '
'with --update_business_templates or without --load'
)
'with --update_business_templates or without --load'
)
def
shortDescription
(
self
):
description
=
str
(
self
)
doc
=
self
.
_testMethodDoc
if
doc
and
doc
.
split
(
"
\
n
"
)[
0
].
strip
():
description
+=
', '
+
doc
.
split
(
"
\
n
"
)[
0
].
strip
()
return
description
def
getRevision
(
self
):
def
getRevision
(
self
):
erp5_path
=
os
.
path
.
join
(
instancehome
,
'Products'
,
'ERP5'
)
erp5_path
=
os
.
path
.
join
(
instancehome
,
'Products'
,
'ERP5'
)
try
:
try
:
...
...
product/ERP5Type/tests/backportUnittest.py
View file @
5f4859aa
...
@@ -189,27 +189,6 @@ if not hasattr(unittest.TestResult, 'addSkip'): # BBB: Python < 2.7
...
@@ -189,27 +189,6 @@ if not hasattr(unittest.TestResult, 'addSkip'): # BBB: Python < 2.7
def
addSkip
(
self
,
test
,
reason
):
def
addSkip
(
self
,
test
,
reason
):
"""Called when a test is skipped."""
"""Called when a test is skipped."""
self
.
skipped
.
append
((
test
,
reason
))
self
.
skipped
.
append
((
test
,
reason
))
def
addExpectedFailure
(
self
,
test
,
err
):
"""Called when an expected failure/error occured."""
self
.
expectedFailures
.
append
(
(
test
,
self
.
_exc_info_to_string
(
err
,
test
)))
def
addUnexpectedSuccess
(
self
,
test
):
"""Called when a test was expected to fail, but succeed."""
self
.
unexpectedSuccesses
.
append
(
test
)
for
f
in
__init__
,
addSkip
,
addExpectedFailure
,
addUnexpectedSuccess
:
setattr
(
unittest
.
TestResult
,
f
.
__name__
,
f
)
class
_TextTestResult
(
unittest
.
_TextTestResult
):
def
wasSuccessful
(
self
):
"Tells whether or not this result was a success"
return
not
(
self
.
failures
or
self
.
errors
or
self
.
unexpectedSuccesses
)
def
addSkip
(
self
,
test
,
reason
):
super
(
_TextTestResult
,
self
).
addSkip
(
test
,
reason
)
if
self
.
showAll
:
if
self
.
showAll
:
self
.
stream
.
writeln
(
"skipped %s"
%
repr
(
reason
))
self
.
stream
.
writeln
(
"skipped %s"
%
repr
(
reason
))
elif
self
.
dots
:
elif
self
.
dots
:
...
@@ -217,7 +196,9 @@ class _TextTestResult(unittest._TextTestResult):
...
@@ -217,7 +196,9 @@ class _TextTestResult(unittest._TextTestResult):
self
.
stream
.
flush
()
self
.
stream
.
flush
()
def
addExpectedFailure
(
self
,
test
,
err
):
def
addExpectedFailure
(
self
,
test
,
err
):
super
(
_TextTestResult
,
self
).
addExpectedFailure
(
test
,
err
)
"""Called when an expected failure/error occured."""
self
.
expectedFailures
.
append
(
(
test
,
self
.
_exc_info_to_string
(
err
,
test
)))
if
self
.
showAll
:
if
self
.
showAll
:
self
.
stream
.
writeln
(
"expected failure"
)
self
.
stream
.
writeln
(
"expected failure"
)
elif
self
.
dots
:
elif
self
.
dots
:
...
@@ -225,13 +206,32 @@ class _TextTestResult(unittest._TextTestResult):
...
@@ -225,13 +206,32 @@ class _TextTestResult(unittest._TextTestResult):
self
.
stream
.
flush
()
self
.
stream
.
flush
()
def
addUnexpectedSuccess
(
self
,
test
):
def
addUnexpectedSuccess
(
self
,
test
):
super
(
_TextTestResult
,
self
).
addUnexpectedSuccess
(
test
)
"""Called when a test was expected to fail, but succeed."""
self
.
unexpectedSuccesses
.
append
(
test
)
if
self
.
showAll
:
if
self
.
showAll
:
self
.
stream
.
writeln
(
"unexpected success"
)
self
.
stream
.
writeln
(
"unexpected success"
)
elif
self
.
dots
:
elif
self
.
dots
:
self
.
stream
.
write
(
"u"
)
self
.
stream
.
write
(
"u"
)
self
.
stream
.
flush
()
self
.
stream
.
flush
()
for
f
in
__init__
,
addSkip
,
addExpectedFailure
,
addUnexpectedSuccess
:
setattr
(
unittest
.
TestResult
,
f
.
__name__
,
f
)
def
getDescription
(
self
,
test
):
doc_first_line
=
test
.
shortDescription
()
if
self
.
descriptions
and
doc_first_line
:
return
'
\
n
'
.
join
((
str
(
test
),
doc_first_line
))
else
:
return
str
(
test
)
unittest
.
_TextTestResult
.
getDescription
=
getDescription
class
_TextTestResult
(
unittest
.
_TextTestResult
):
def
wasSuccessful
(
self
):
"Tells whether or not this result was a success"
return
not
(
self
.
failures
or
self
.
errors
or
self
.
unexpectedSuccesses
)
def
printErrors
(
self
):
def
printErrors
(
self
):
if
self
.
dots
or
self
.
showAll
:
if
self
.
dots
or
self
.
showAll
:
self
.
stream
.
writeln
()
self
.
stream
.
writeln
()
...
...
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