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
Carlos Ramos Carreño
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
Show 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
...
@@ -35,6 +35,7 @@ import shutil
import
tempfile
import
tempfile
import
unittest
import
unittest
import
warnings
import
warnings
import
re
import
sys
import
sys
import
transaction
import
transaction
...
@@ -3215,12 +3216,9 @@ class Test(ERP5TypeTestCase):
...
@@ -3215,12 +3216,9 @@ class Test(ERP5TypeTestCase):
ERP5TypeTestCase
.
__bases__
=
base_tuple
ERP5TypeTestCase
.
__bases__
=
base_tuple
ERP5TypeTestLoader
.
loadTestsFromNames
=
ERP5TypeTestLoader_loadTestsFromNames
ERP5TypeTestLoader
.
loadTestsFromNames
=
ERP5TypeTestLoader_loadTestsFromNames
# assertRegexpMatches is only available from Python >= 2.7
import
re
output
=
self
.
_component_tool
.
readTestOutput
()
output
=
self
.
_component_tool
.
readTestOutput
()
self
.
assertNotEqual
(
re
.
search
(
'Ran 1 test.*OK'
,
output
,
re
.
DOTALL
),
None
,
expected_msg_re
=
re
.
compile
(
'Ran 1 test.*OK'
,
re
.
DOTALL
)
"Expected 'Ran 1 test.*OK' in '%s'"
%
output
)
self
.
assertRegex
(
output
,
expected_msg_re
)
# Secondly, add a test which will always fail
# Secondly, add a test which will always fail
source_code
+=
'''
source_code
+=
'''
...
@@ -3244,12 +3242,9 @@ class Test(ERP5TypeTestCase):
...
@@ -3244,12 +3242,9 @@ class Test(ERP5TypeTestCase):
ERP5TypeTestCase
.
__bases__
=
base_tuple
ERP5TypeTestCase
.
__bases__
=
base_tuple
ERP5TypeTestLoader
.
loadTestsFromNames
=
ERP5TypeTestLoader_loadTestsFromNames
ERP5TypeTestLoader
.
loadTestsFromNames
=
ERP5TypeTestLoader_loadTestsFromNames
# assertRegexpMatches is only available from Python >= 2.7
import
re
output
=
self
.
_component_tool
.
readTestOutput
()
output
=
self
.
_component_tool
.
readTestOutput
()
expected_msg_re_str
=
'Ran 2 tests.*FAILED
\
(
f
ailures=1
\
)
'
expected_msg_re
=
re
.
compile
(
'Ran 2 tests.*FAILED
\
(
f
ailures=1
\
)
'
, re.DOTALL)
self.assertNotEqual(re.search(expected_msg_re_str, output, re.DOTALL), None,
self.assertRegex(output, expected_msg_re)
"Expected '
%
s
' in '
%
s
'" % (expected_msg_re_str, output))
def testERP5Broken(self):
def testERP5Broken(self):
# Create a broken ghost object
# 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