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
2124e9a7
Commit
2124e9a7
authored
Feb 19, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ProcessingNodeTestCase: python3 compatibility for DictPersistentWrapper
parent
c78c9aff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
product/ERP5Type/tests/ProcessingNodeTestCase.py
product/ERP5Type/tests/ProcessingNodeTestCase.py
+16
-7
No files found.
product/ERP5Type/tests/ProcessingNodeTestCase.py
View file @
2124e9a7
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
abc
import
errno
,
logging
,
mock
,
os
,
socket
,
time
import
errno
,
logging
,
mock
,
os
,
socket
,
time
import
itertools
import
itertools
from
threading
import
Thread
from
threading
import
Thread
from
UserDict
import
IterableUserDict
import
six
if
six
.
PY2
:
from
UserDict
import
IterableUserDict
as
UserDict
else
:
from
collections
import
UserDict
import
Lifetime
import
Lifetime
import
transaction
import
transaction
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
...
@@ -16,9 +21,8 @@ from Products.ERP5Type.tests.utils import \
...
@@ -16,9 +21,8 @@ from Products.ERP5Type.tests.utils import \
from
Products.CMFActivity.ActivityTool
import
getCurrentNode
from
Products.CMFActivity.ActivityTool
import
getCurrentNode
class
DictPersistentWrapper
(
IterableUserDict
,
object
):
class
DictPersistentWrapperMetaClass
(
abc
.
ABCMeta
):
def
__new__
(
cls
,
name
,
base
,
d
):
def
__metaclass__
(
name
,
base
,
d
):
def
wrap
(
attr
):
def
wrap
(
attr
):
wrapped
=
getattr
(
base
[
0
],
attr
)
wrapped
=
getattr
(
base
[
0
],
attr
)
def
wrapper
(
self
,
*
args
,
**
kw
):
def
wrapper
(
self
,
*
args
,
**
kw
):
...
@@ -28,7 +32,12 @@ class DictPersistentWrapper(IterableUserDict, object):
...
@@ -28,7 +32,12 @@ class DictPersistentWrapper(IterableUserDict, object):
return
wrapper
return
wrapper
for
attr
in
(
'clear'
,
'setdefault'
,
'update'
,
'__setitem__'
,
'__delitem__'
):
for
attr
in
(
'clear'
,
'setdefault'
,
'update'
,
'__setitem__'
,
'__delitem__'
):
d
[
attr
]
=
wrap
(
attr
)
d
[
attr
]
=
wrap
(
attr
)
return
type
(
name
,
base
,
d
)
return
super
(
DictPersistentWrapperMetaClass
,
cls
).
__new__
(
cls
,
name
,
base
,
d
)
@
six
.
add_metaclass
(
DictPersistentWrapperMetaClass
)
class
DictPersistentWrapper
(
UserDict
,
object
):
def
__init__
(
self
,
dict
,
persistent_object
):
def
__init__
(
self
,
dict
,
persistent_object
):
self
.
data
=
dict
self
.
data
=
dict
...
@@ -172,7 +181,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
...
@@ -172,7 +181,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
s
.
listen
(
0
)
s
.
listen
(
0
)
except
socket
.
error
as
e
:
except
socket
.
error
as
e
:
s
.
close
()
s
.
close
()
if
e
[
0
]
!=
errno
.
EADDRINUSE
:
if
e
.
args
[
0
]
!=
errno
.
EADDRINUSE
:
raise
raise
if
zserver
:
if
zserver
:
raise
RuntimeError
(
str
(
e
))
raise
RuntimeError
(
str
(
e
))
...
@@ -337,7 +346,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
...
@@ -337,7 +346,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
This aborts current transaction.
This aborts current transaction.
"""
"""
for
i
in
x
range
(
60
):
for
i
in
range
(
60
):
node_list
=
list
(
self
.
portal
.
portal_activities
.
getProcessingNodeList
())
node_list
=
list
(
self
.
portal
.
portal_activities
.
getProcessingNodeList
())
if
len
(
node_list
)
>=
node_count
:
if
len
(
node_list
)
>=
node_count
:
node_list
.
remove
(
getCurrentNode
())
node_list
.
remove
(
getCurrentNode
())
...
...
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