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
1
Issues
1
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
Roque
erp5
Commits
f4a1afdd
Commit
f4a1afdd
authored
Feb 14, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CodingStyleTestCase: check rebuilding tested BT to catch packaging problems
parent
d6d78689
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
product/ERP5Type/tests/CodingStyleTestCase.py
product/ERP5Type/tests/CodingStyleTestCase.py
+28
-0
No files found.
product/ERP5Type/tests/CodingStyleTestCase.py
View file @
f4a1afdd
...
...
@@ -27,6 +27,10 @@
#
##############################################################################
import
tarfile
import
os
import
glob
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Testing
import
ZopeTestCase
from
Acquisition
import
aq_base
...
...
@@ -97,3 +101,27 @@ class CodingStyleTestCase(ERP5TypeTestCase):
for
business_template
in
self
.
portal
.
portal_templates
.
contentValues
():
if
business_template
.
getTitle
()
in
self
.
getTestedBusinessTemplateList
():
self
.
assertEqual
([],
business_template
.
BusinessTemplate_getPythonSourceCodeMessageList
())
def
test_rebuild_business_template
(
self
):
"""Try to rebuild business template to catch packaging errors.
"""
template_tool
=
self
.
portal
.
portal_templates
for
bt_title
in
self
.
getTestedBusinessTemplateList
():
bt
=
template_tool
.
getInstalledBusinessTemplate
(
bt_title
,
strict
=
True
)
# make sure we can rebuild
bt
.
build
()
# check we don't add or remove members.
# first, build a set of files that were on the original business template repository
base_path
,
local_path
=
self
.
portal
.
portal_templates
.
getLastestBTOnRepos
(
bt_title
)
existing_files
=
set
([
os
.
path
.
relpath
(
y
,
base_path
)
for
x
in
os
.
walk
(
os
.
path
.
join
(
base_path
,
local_path
))
for
y
in
glob
.
glob
(
os
.
path
.
join
(
x
[
0
],
'*'
))
if
os
.
path
.
isfile
(
y
)])
# then compare this with the files in the newly exported business template.
bt_file
=
bt
.
export
()
bt_file
.
seek
(
0
)
# XXX this StringIO was already read...
new_files
=
set
(
tarfile
.
open
(
fileobj
=
bt_file
,
mode
=
'r:gz'
).
getnames
())
self
.
maxDiff
=
None
self
.
assertEqual
(
existing_files
,
new_files
)
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