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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
3ff662dd
Commit
3ff662dd
authored
Apr 15, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bt search path for testXHTML
parent
16a43189
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
32 deletions
+26
-32
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+26
-32
No files found.
product/ERP5/tests/testXHTML.py
View file @
3ff662dd
...
@@ -34,23 +34,24 @@ import urllib
...
@@ -34,23 +34,24 @@ import urllib
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
from
Products.ERP5
import
__file__
as
ERP5PackagePath
from
Products.ERP5
import
__file__
as
ERP5PackagePath
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
from
AccessControl.SecurityManagement
import
newSecurityManager
from
zLOG
import
LOG
from
zLOG
import
LOG
from
xml.dom
import
minidom
from
xml.dom
import
minidom
from
glob
import
glob
#
# Test Setting
#
INSTANCE_HOME
=
os
.
environ
[
'INSTANCE_HOME'
]
INSTANCE_HOME
=
os
.
environ
[
'INSTANCE_HOME'
]
bt5_base_path
=
os
.
environ
.
get
(
'erp5_tests_bt5_path'
,
bt5_base_path
=
os
.
environ
.
get
(
'erp5_tests_bt5_path'
,
os
.
path
.
join
(
INSTANCE_HOME
,
'bt5'
))
os
.
path
.
join
(
INSTANCE_HOME
,
'bt5'
))
bootstrap_base_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
ERP5PackagePath
),
bootstrap_base_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
ERP5PackagePath
),
'bootstrap'
)
'bootstrap'
)
# if Products.ERP5 is a git checkout, then this folder will contain bt5s
repository_base_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
ERP5PackagePath
),
'..'
,
'..'
,
'bt5'
)
bt5_search_path_list
=
'%s,%s,%s'
%
(
bt5_base_path
,
bootstrap_base_path
,
repository_base_path
)
# some forms have intentionally empty listbox selections like RSS generators
# some forms have intentionally empty listbox selections like RSS generators
FORM_LISTBOX_EMPTY_SELECTION_PATH_LIST
=
[
'erp5_web_widget_library/WebSection_viewContentListAsRSS'
]
FORM_LISTBOX_EMPTY_SELECTION_PATH_LIST
=
[
'erp5_web_widget_library/WebSection_viewContentListAsRSS'
]
...
@@ -365,7 +366,12 @@ class W3Validator(object):
...
@@ -365,7 +366,12 @@ class W3Validator(object):
line_number, col_number, error description
line_number, col_number, error description
"""
"""
result_list_list
=
[]
result_list_list
=
[]
try
:
xml_doc
=
minidom
.
parseString
(
result
)
xml_doc
=
minidom
.
parseString
(
result
)
except
:
import
sys
print
>>
sys
.
stderr
,
"Could not parse result:
\
n
%s"
%
result
raise
for
severity
in
'm:error'
,
'm:warning'
:
for
severity
in
'm:error'
,
'm:warning'
:
result_list
=
[]
result_list
=
[]
for
error
in
xml_doc
.
getElementsByTagName
(
severity
):
for
error
in
xml_doc
.
getElementsByTagName
(
severity
):
...
@@ -422,14 +428,12 @@ class TidyValidator(object):
...
@@ -422,14 +428,12 @@ class TidyValidator(object):
location_list
=
data
[
0
].
split
(
' '
)
location_list
=
data
[
0
].
split
(
' '
)
line
=
location_list
[
1
]
line
=
location_list
[
1
]
column
=
location_list
[
3
]
column
=
location_list
[
3
]
error
=
True
message
=
data
[
1
].
split
(
': '
)[
1
]
message
=
data
[
1
].
split
(
': '
)[
1
]
error_list
.
append
((
line
,
column
,
message
))
error_list
.
append
((
line
,
column
,
message
))
elif
data
[
1
].
startswith
(
'Warning: '
):
elif
data
[
1
].
startswith
(
'Warning: '
):
location_list
=
data
[
0
].
split
(
' '
)
location_list
=
data
[
0
].
split
(
' '
)
line
=
location_list
[
1
]
line
=
location_list
[
1
]
column
=
location_list
[
3
]
column
=
location_list
[
3
]
warning
=
True
message
=
data
[
1
].
split
(
': '
)[
1
]
message
=
data
[
1
].
split
(
': '
)[
1
]
warning_list
.
append
((
line
,
column
,
message
))
warning_list
.
append
((
line
,
column
,
message
))
return
(
error_list
,
warning_list
)
return
(
error_list
,
warning_list
)
...
@@ -583,30 +587,20 @@ def addTestMethodDynamically(validator, target_business_templates):
...
@@ -583,30 +587,20 @@ def addTestMethodDynamically(validator, target_business_templates):
business_template_info_list
=
[]
business_template_info_list
=
[]
for
i
in
target_business_templates
:
for
i
in
target_business_templates
:
business_template
=
os
.
path
.
join
(
bt5_base_path
,
i
)
for
bt5_search_path
in
bt5_search_path_list
.
split
(
','
):
business_template
=
os
.
path
.
join
(
bt5_search_path
,
i
)
# Look for business templates, they can be:
business_template_info
=
None
# .bt5 files in $INSTANCE_HOME/bt5/
if
(
os
.
path
.
exists
(
business_template
)
or
# directories in $INSTANCE_HOME/
# directories in $INSTANCE_HOME/bt5/*/
# directories in $INSTANCE_HOME/Products/ERP5/bootstrap/
if
not
(
os
.
path
.
exists
(
business_template
)
or
os
.
path
.
exists
(
'%s.bt5'
%
business_template
)):
os
.
path
.
exists
(
'%s.bt5'
%
business_template
)):
# try in $INSTANCE_HOME/bt5/*/
business_template_glob_list
=
glob
(
'%s/*/%s'
%
(
bt5_base_path
,
i
))
if
business_template_glob_list
:
business_template
=
business_template_glob_list
[
0
]
else
:
# try in $INSTANCE_HOME/Products/ERP5/bootstrap
business_template
=
os
.
path
.
join
(
bootstrap_base_path
,
i
)
if
os
.
path
.
isdir
(
business_template
):
if
os
.
path
.
isdir
(
business_template
):
business_template_info
=
BusinessTemplateInfoDir
(
business_template
)
business_template_info
=
BusinessTemplateInfoDir
(
business_template
)
elif
os
.
path
.
isfile
(
business_template
+
'.bt5'
):
elif
os
.
path
.
isfile
(
business_template
+
'.bt5'
):
business_template_info
=
BusinessTemplateInfoTar
(
business_template
+
'.bt5'
)
business_template_info
=
BusinessTemplateInfoTar
(
business_template
+
'.bt5'
)
else
:
if
business_template_info
is
not
None
:
raise
KeyError
,
"Can't find the business template: %s"
%
i
business_template_info_list
.
append
(
business_template_info
)
business_template_info_list
.
append
(
business_template_info
)
break
else
:
raise
KeyError
,
"Can't find business template %s"
%
i
tested_portal_type_list
=
[]
tested_portal_type_list
=
[]
for
business_template_info
in
business_template_info_list
:
for
business_template_info
in
business_template_info_list
:
...
...
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