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
Labels
Merge Requests
139
Merge Requests
139
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
a1766606
Commit
a1766606
authored
Jan 19, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testDynamicClassGeneration: use assertRegex
This was old compatibility code
parent
fcd26be0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+5
-10
No files found.
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
a1766606
...
...
@@ -35,6 +35,7 @@ import shutil
import
tempfile
import
unittest
import
warnings
import
re
import
sys
import
transaction
...
...
@@ -3215,12 +3216,9 @@ class Test(ERP5TypeTestCase):
ERP5TypeTestCase
.
__bases__
=
base_tuple
ERP5TypeTestLoader
.
loadTestsFromNames
=
ERP5TypeTestLoader_loadTestsFromNames
# assertRegexpMatches is only available from Python >= 2.7
import
re
output
=
self
.
_component_tool
.
readTestOutput
()
self
.
assertNotEqual
(
re
.
search
(
'Ran 1 test.*OK'
,
output
,
re
.
DOTALL
),
None
,
"Expected 'Ran 1 test.*OK' in '%s'"
%
output
)
expected_msg_re
=
re
.
compile
(
'Ran 1 test.*OK'
,
re
.
DOTALL
)
self
.
assertRegex
(
output
,
expected_msg_re
)
# Secondly, add a test which will always fail
source_code
+=
'''
...
...
@@ -3244,12 +3242,9 @@ class Test(ERP5TypeTestCase):
ERP5TypeTestCase
.
__bases__
=
base_tuple
ERP5TypeTestLoader
.
loadTestsFromNames
=
ERP5TypeTestLoader_loadTestsFromNames
# assertRegexpMatches is only available from Python >= 2.7
import
re
output
=
self
.
_component_tool
.
readTestOutput
()
expected_msg_re_str
=
'Ran 2 tests.*FAILED
\
(
f
ailures=1
\
)
'
self.assertNotEqual(re.search(expected_msg_re_str, output, re.DOTALL), None,
"Expected '
%
s
' in '
%
s
'" % (expected_msg_re_str, output))
expected_msg_re
=
re
.
compile
(
'Ran 2 tests.*FAILED
\
(
f
ailures=1
\
)
'
, re.DOTALL)
self.assertRegex(output, expected_msg_re)
def testERP5Broken(self):
# Create a broken ghost object
...
...
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