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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
e0ef4064
Commit
e0ef4064
authored
Sep 13, 2023
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui_dump_test: fix comparison between expected & actual results
Due to some debug code, it never checked anything.
parent
8e9c6d42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
product/ERP5Type/tests/ui_dump_test.py
product/ERP5Type/tests/ui_dump_test.py
+20
-20
No files found.
product/ERP5Type/tests/ui_dump_test.py
View file @
e0ef4064
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#
#
##############################################################################
##############################################################################
import
os
,
sys
,
weakref
import
errno
,
os
,
sys
,
weakref
from
difflib
import
unified_diff
from
difflib
import
unified_diff
from
pprint
import
pprint
,
pformat
from
pprint
import
pprint
,
pformat
from
AccessControl.SecurityManagement
\
from
AccessControl.SecurityManagement
\
...
@@ -41,8 +41,7 @@ class ui_dump_test(object):
...
@@ -41,8 +41,7 @@ class ui_dump_test(object):
"""
"""
User Interface dump generator while running unit test.
User Interface dump generator while running unit test.
This class is usually subclassed. If you wish to store dump file,
This class is usually subclassed.
you should export os environment variable "save_<subclass_name>=1"
"""
"""
_enabled
=
None
_enabled
=
None
...
@@ -165,24 +164,25 @@ class ui_dump_test(object):
...
@@ -165,24 +164,25 @@ class ui_dump_test(object):
context
=
self
.
context
context
=
self
.
context
test_file
=
sys
.
modules
[
context
.
__class__
.
__module__
].
__file__
test_file
=
sys
.
modules
[
context
.
__class__
.
__module__
].
__file__
dump_name
=
self
.
__class__
.
__name__
dump_name
=
self
.
__class__
.
__name__
dump_path
=
os
.
path
.
join
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
test_file
)),
dump_path
=
save_path
=
os
.
path
.
join
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
test_file
)),
dump_name
,
'%s.py'
%
context
.
id
())
dump_name
,
'%s.py'
%
context
.
id
())
save_env_name
=
'save_'
+
dump_name
try
:
if
os
.
environ
.
get
(
save_env_name
)
==
'1'
:
try
:
with
open
(
dump_path
,
'w'
)
as
f
:
pprint
(
self
.
dump
,
f
)
else
:
# The following 2 lines are only for debugging purpose: it saves the
# actual results in a temporary place, so that when the diff is not
# clear enough, one can inspect them in whole.
with
open
(
dump_path
,
'w'
)
as
f
:
pprint
(
self
.
dump
,
f
)
with
open
(
dump_path
)
as
f
:
with
open
(
dump_path
)
as
f
:
diff
=
self
.
diff
(
f
.
read
())
diff
=
self
.
diff
(
f
.
read
())
except
IOError
as
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
save_path
=
None
raise
if
diff
:
if
diff
:
msg
=
(
"UI dump for %r changed:
\
n
%s
\
n
\
n
To update the dump, please"
save_path
+=
'.new'
" run the test again setting the environment variable %r to 1."
)
context
.
fail
(
"UI dump for %r changed:
\
n
%s"
%
(
dump_path
,
diff
))
context
.
fail
(
msg
%
(
dump_path
,
diff
,
save_env_name
))
save_path
=
None
finally
:
if
save_path
:
with
open
(
save_path
,
'w'
)
as
f
:
pprint
(
self
.
dump
,
f
)
def
getTrackingKey
(
self
,
path
,
obj
):
def
getTrackingKey
(
self
,
path
,
obj
):
"""Return the 'type' of object (only 1 object per 'type' is tracked)
"""Return the 'type' of object (only 1 object per 'type' is tracked)
...
...
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