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
248940fe
Commit
248940fe
authored
Jun 01, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
core_test: Add test to make sure that wendelin.core basically works
See merge request
nexedi/erp5!1429
parents
53d2ec13
5796a17a
Pipeline
#15746
failed with stage
Changes
4
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
0 deletions
+209
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWendelinCore.py
...plateItem/portal_components/test.erp5.testWendelinCore.py
+69
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWendelinCore.xml
...lateItem/portal_components/test.erp5.testWendelinCore.xml
+127
-0
bt5/erp5_core_test/bt/template_test_id_list
bt5/erp5_core_test/bt/template_test_id_list
+1
-0
product/ERP5Type/patches/pylint.py
product/ERP5Type/patches/pylint.py
+12
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWendelinCore.py
0 → 100644
View file @
248940fe
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2021 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
#
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
wendelin.bigarray.array_zodb
import
ZBigArray
from
numpy.testing
import
assert_array_equal
import
transaction
# Minimal test to make sure that wendelin.core works at all.
class
TestWendelinCoreBasic
(
ERP5TypeTestCase
):
def
test
(
self
):
# create the array in temporary "root" placeholder.
# NOTE we need created objects to enter ZODB for real, but
# newContent(temp_object=True) creates an object with ._p_jar=None
zroot
=
self
.
portal
.
newContent
()
zroot
.
zarray
=
A
=
ZBigArray
(
shape
=
(
4
,),
dtype
=
int
)
self
.
commit
()
self
.
assertIsNotNone
(
zroot
.
_p_jar
)
# zroot enters ZODB
self
.
assertIsNotNone
(
A
.
_p_jar
)
# zarray ----//----
# the array must initially read as all zeros
a
=
A
[:]
assert_array_equal
(
a
,
[
0
,
0
,
0
,
0
])
b
=
A
[:]
assert_array_equal
(
b
,
[
0
,
0
,
0
,
0
])
# we can assign items in a view, and the assignment propagates to another view
a
[
2
]
=
1
assert_array_equal
(
a
,
[
0
,
0
,
1
,
0
])
assert_array_equal
(
b
,
[
0
,
0
,
1
,
0
])
# on abort local changes are reverted
transaction
.
abort
()
assert_array_equal
(
a
,
[
0
,
0
,
0
,
0
])
assert_array_equal
(
b
,
[
0
,
0
,
0
,
0
])
# on commit local changes are saved into ZODB
a
[
1
]
=
3
b
[
2
]
=
4
assert_array_equal
(
a
,
[
0
,
3
,
4
,
0
])
assert_array_equal
(
b
,
[
0
,
3
,
4
,
0
])
self
.
commit
()
transaction
.
abort
()
# just in case
c
=
A
[:]
assert_array_equal
(
a
,
[
0
,
3
,
4
,
0
])
assert_array_equal
(
b
,
[
0
,
3
,
4
,
0
])
assert_array_equal
(
c
,
[
0
,
3
,
4
,
0
])
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWendelinCore.xml
0 → 100644
View file @
248940fe
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testWendelinCore
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testWendelinCore
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_core_test/bt/template_test_id_list
View file @
248940fe
...
@@ -54,6 +54,7 @@ test.erp5.testTransactionalVariable
...
@@ -54,6 +54,7 @@ test.erp5.testTransactionalVariable
test.erp5.testTrashTool
test.erp5.testTrashTool
test.erp5.testVanillaERP5Catalog
test.erp5.testVanillaERP5Catalog
test.erp5.testVideoField
test.erp5.testVideoField
test.erp5.testWendelinCore
test.erp5.testWorkflowHistoryList
test.erp5.testWorkflowHistoryList
test.erp5.testWorklist
test.erp5.testWorklist
test.erp5.testXForwardedFor
test.erp5.testXForwardedFor
...
...
product/ERP5Type/patches/pylint.py
View file @
248940fe
...
@@ -327,6 +327,18 @@ for filename in os.listdir(os.path.dirname(lxml.__file__)):
...
@@ -327,6 +327,18 @@ for filename in os.listdir(os.path.dirname(lxml.__file__)):
module_name
,
module_name
,
__import__
(
module_name
,
fromlist
=
[
module_name
],
level
=
0
))
__import__
(
module_name
,
fromlist
=
[
module_name
],
level
=
0
))
# Wendelin is special namespace package which pylint fails to recognize, and so
# complains about things like `from wendelin.bigarray.array_zodb import ZBigArray`
# with `No name 'bigarray' in module 'wendelin' (no-name-in-module)`.
#
# -> Teach pylint to properly understand wendelin package nature.
import
wendelin
def
wendelin_transform
(
node
):
m
=
AstroidBuilder
(
MANAGER
).
string_build
(
'__path__ = %r'
%
wendelin
.
__path__
)
m
.
package
=
True
return
m
MANAGER
.
register_transform
(
Module
,
wendelin_transform
,
lambda
node
:
node
.
name
==
'wendelin'
)
# Properly search for namespace packages: original astroid (as of 1.3.8) only
# Properly search for namespace packages: original astroid (as of 1.3.8) only
# checks at top-level and it doesn't work for Shared.DC.ZRDB (defined in
# checks at top-level and it doesn't work for Shared.DC.ZRDB (defined in
# Products.ZSQLMethods; Shared and Shared.DC being a namespace package defined
# Products.ZSQLMethods; Shared and Shared.DC being a namespace package defined
...
...
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