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
Léo-Paul Géneau
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
Hide 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 -*-
import
abc
import
errno
,
logging
,
mock
,
os
,
socket
,
time
import
itertools
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
transaction
from
Testing
import
ZopeTestCase
...
...
@@ -16,9 +21,8 @@ from Products.ERP5Type.tests.utils import \
from
Products.CMFActivity.ActivityTool
import
getCurrentNode
class
DictPersistentWrapper
(
IterableUserDict
,
object
):
def
__metaclass__
(
name
,
base
,
d
):
class
DictPersistentWrapperMetaClass
(
abc
.
ABCMeta
):
def
__new__
(
cls
,
name
,
base
,
d
):
def
wrap
(
attr
):
wrapped
=
getattr
(
base
[
0
],
attr
)
def
wrapper
(
self
,
*
args
,
**
kw
):
...
...
@@ -28,7 +32,12 @@ class DictPersistentWrapper(IterableUserDict, object):
return
wrapper
for
attr
in
(
'clear'
,
'setdefault'
,
'update'
,
'__setitem__'
,
'__delitem__'
):
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
):
self
.
data
=
dict
...
...
@@ -172,7 +181,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
s
.
listen
(
0
)
except
socket
.
error
as
e
:
s
.
close
()
if
e
[
0
]
!=
errno
.
EADDRINUSE
:
if
e
.
args
[
0
]
!=
errno
.
EADDRINUSE
:
raise
if
zserver
:
raise
RuntimeError
(
str
(
e
))
...
...
@@ -337,7 +346,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
This aborts current transaction.
"""
for
i
in
x
range
(
60
):
for
i
in
range
(
60
):
node_list
=
list
(
self
.
portal
.
portal_activities
.
getProcessingNodeList
())
if
len
(
node_list
)
>=
node_count
:
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