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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xueyun Qian
erp5
Commits
272ac2f7
Commit
272ac2f7
authored
Mar 05, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to run ZODB Test Component tests from Component Tool, likewise Class Tool.
parent
4443075c
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1624 additions
and
5 deletions
+1624
-5
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Component%20Tool/run_live_test.xml
...plateItem/portal_types/Component%20Tool/run_live_test.xml
+85
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_refreshLiveTestDialog.xml
...l_skins/erp5_core/ComponentTool_refreshLiveTestDialog.xml
+72
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog.xml
...rtal_skins/erp5_core/ComponentTool_viewLiveTestDialog.xml
+158
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_debug.xml
...erp5_core/ComponentTool_viewLiveTestDialog/your_debug.xml
+168
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_run_only.xml
...5_core/ComponentTool_viewLiveTestDialog/your_run_only.xml
+260
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_test.xml
.../erp5_core/ComponentTool_viewLiveTestDialog/your_test.xml
+260
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_text_output.xml
...ore/ComponentTool_viewLiveTestDialog/your_text_output.xml
+280
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_verbose.xml
...p5_core/ComponentTool_viewLiveTestDialog/your_verbose.xml
+168
-0
product/ERP5/bootstrap/erp5_core/bt/change_log
product/ERP5/bootstrap/erp5_core/bt/change_log
+3
-0
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5/bootstrap/erp5_core/bt/template_action_path_list
...uct/ERP5/bootstrap/erp5_core/bt/template_action_path_list
+1
-0
product/ERP5Type/Tool/ComponentTool.py
product/ERP5Type/Tool/ComponentTool.py
+69
-0
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
+6
-4
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+93
-0
No files found.
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Component%20Tool/run_live_test.xml
0 → 100644
View file @
272ac2f7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_action
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_action
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
run_live_test
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
1.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Run Live Tests
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/ComponentTool_viewLiveTestDialog
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_refreshLiveTestDialog.xml
0 → 100644
View file @
272ac2f7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
request = context.REQUEST\n
if request.get(\'form\', None) is not None:\n
context.REQUEST[\'form\'][\'field_your_text_output\']=""\n
context.REQUEST[\'form\'][\'text_output\']=""\n
return context.ComponentTool_viewLiveTestDialog(\n
text_output="")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
debug=None,verbose=None,test=None,run_only=None,**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComponentTool_refreshLiveTestDialog
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog.xml
0 → 100644
View file @
272ac2f7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5Form"
module=
"Products.ERP5Form.Form"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
ComponentTool_refreshLiveTestDialog
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
enctype
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<list>
<string>
left
</string>
<string>
right
</string>
<string>
center
</string>
<string>
bottom
</string>
<string>
hidden
</string>
</list>
</value>
</item>
<item>
<key>
<string>
groups
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
bottom
</string>
</key>
<value>
<list>
<string>
your_text_output
</string>
</list>
</value>
</item>
<item>
<key>
<string>
center
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
your_test
</string>
<string>
your_run_only
</string>
</list>
</value>
</item>
<item>
<key>
<string>
right
</string>
</key>
<value>
<list>
<string>
your_debug
</string>
<string>
your_verbose
</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComponentTool_viewLiveTestDialog
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
ComponentTool_viewLiveTestDialog
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_dialog
</string>
</value>
</item>
<item>
<key>
<string>
row_length
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
stored_encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Live Tests
</string>
</value>
</item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_debug.xml
0 → 100644
View file @
272ac2f7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"CheckBoxField"
module=
"Products.Formulator.StandardFields"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_debug
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Debug
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_run_only.xml
0 → 100644
View file @
272ac2f7
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_test.xml
0 → 100644
View file @
272ac2f7
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_text_output.xml
0 → 100644
View file @
272ac2f7
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/your_verbose.xml
0 → 100644
View file @
272ac2f7
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"CheckBoxField"
module=
"Products.Formulator.StandardFields"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_verbose
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Verbose
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/bt/change_log
View file @
272ac2f7
2012-03-05 arnaud.fontaine
* Allow to run ZODB Test Component tests from Component Tool, likewise Class Tool.
2012-03-03 arnaud.fontaine
2012-03-03 arnaud.fontaine
* Remove defined groups on ZODB Component portal types as it should not be considered as a Document for DMS for example.
* Remove defined groups on ZODB Component portal types as it should not be considered as a Document for DMS for example.
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
272ac2f7
41025
41026
\ No newline at end of file
\ No newline at end of file
product/ERP5/bootstrap/erp5_core/bt/template_action_path_list
View file @
272ac2f7
...
@@ -59,6 +59,7 @@ Category Tool | view
...
@@ -59,6 +59,7 @@ Category Tool | view
Category | view
Category | view
Class Tool | run_live_test
Class Tool | run_live_test
Class Tool | view
Class Tool | view
Component Tool | run_live_test
Component Tool | view
Component Tool | view
Conceptual Id Generator | view
Conceptual Id Generator | view
Content Existence Constraint | predicate
Content Existence Constraint | predicate
...
...
product/ERP5Type/Tool/ComponentTool.py
View file @
272ac2f7
...
@@ -41,6 +41,8 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
...
@@ -41,6 +41,8 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from
zLOG
import
LOG
,
INFO
,
WARNING
from
zLOG
import
LOG
,
INFO
,
WARNING
global_stream
=
None
from
DateTime
import
DateTime
from
DateTime
import
DateTime
DEFAULT_TEST_TEMPLATE_COPYRIGHT
=
"Copyright (c) 2002-%s Nexedi SA and "
\
DEFAULT_TEST_TEMPLATE_COPYRIGHT
=
"Copyright (c) 2002-%s Nexedi SA and "
\
"Contributors. All Rights Reserved."
%
DateTime
().
year
()
"Contributors. All Rights Reserved."
%
DateTime
().
year
()
...
@@ -193,8 +195,75 @@ class Test(ERP5TypeTestCase):
...
@@ -193,8 +195,75 @@ class Test(ERP5TypeTestCase):
Create new content. If this is a Test Component and no text_content has
Create new content. If this is a Test Component and no text_content has
been given, then define a default template to help user, likewise
been given, then define a default template to help user, likewise
ClassTool with filesystem live tests
ClassTool with filesystem live tests
XXX-arnau: should include more templates like ClassTool
"""
"""
if
kwargs
.
get
(
'portal_type'
)
==
'Test Component'
:
if
kwargs
.
get
(
'portal_type'
)
==
'Test Component'
:
kwargs
.
setdefault
(
'text_content'
,
self
.
__test_text_content_template
)
kwargs
.
setdefault
(
'text_content'
,
self
.
__test_text_content_template
)
return
super
(
ComponentTool
,
self
).
newContent
(
*
args
,
**
kwargs
)
return
super
(
ComponentTool
,
self
).
newContent
(
*
args
,
**
kwargs
)
# XXX-arnau: copy/paste from ClassTool which portal_components is supposed
# to replace at some point
security
.
declarePrivate
(
'_getCommaSeparatedParameterList'
)
def
_getCommaSeparatedParameterList
(
self
,
parameter_list
):
# clean parameter_list and split it by commas if necessary
if
not
parameter_list
:
parameter_list
=
()
elif
isinstance
(
parameter_list
,
basestring
):
parameter_list
=
tuple
(
parameter_name
.
strip
()
for
parameter_name
in
parameter_list
.
split
(
','
)
if
parameter_name
.
strip
())
return
parameter_list
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'runLiveTest'
)
def
runLiveTest
(
self
,
test_list
=
None
,
run_only
=
None
,
debug
=
False
,
verbose
=
False
):
"""
Launch live tests
run_only=STRING Run only specified test methods delimited with
commas (e.g. testFoo,testBar). This can be regular
expressions.
debug=boolean Invoke debugger on errors / failures.
verbose=boolean Display more informations when running tests
"""
test_list
=
self
.
_getCommaSeparatedParameterList
(
test_list
)
if
not
test_list
:
# no test to run
return
''
# Allow having strings for verbose and debug
verbose
=
int
(
verbose
)
and
True
or
False
debug
=
int
(
debug
)
and
True
or
False
run_only
=
self
.
_getCommaSeparatedParameterList
(
run_only
)
verbosity
=
verbose
and
2
or
1
from
StringIO
import
StringIO
global
global_stream
global_stream
=
StringIO
()
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
runLiveTest
try
:
result
=
runLiveTest
(
test_list
,
run_only
=
run_only
,
debug
=
debug
,
stream
=
global_stream
,
verbosity
=
verbosity
)
except
ImportError
:
import
traceback
traceback
.
print_exc
(
file
=
global_stream
)
global_stream
.
seek
(
0
)
return
global_stream
.
read
()
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'readTestOutput'
)
def
readTestOutput
(
self
,
position
=
0
):
"""
Return unread part of the test result
"""
result
=
''
position
=
int
(
position
)
global
global_stream
if
global_stream
is
not
None
:
global_stream
.
seek
(
position
)
result
=
global_stream
.
read
()
return
result
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
View file @
272ac2f7
...
@@ -165,11 +165,13 @@ class ERP5TypeTestReLoader(ERP5TypeTestLoader):
...
@@ -165,11 +165,13 @@ class ERP5TypeTestReLoader(ERP5TypeTestLoader):
import
erp5.component.test
import
erp5.component.test
try
:
try
:
module
=
__import__
(
'erp5.component.test.'
+
name
,
__import__
(
'erp5.component.test.'
+
name
,
fromlist
=
[
'erp5.component.test'
],
fromlist
=
[
'erp5.component.test'
],
level
=
0
)
level
=
0
)
except
ImportError
:
except
ImportError
:
pass
pass
else
:
module
=
erp5
.
component
.
test
return
super
(
ERP5TypeTestReLoader
,
self
).
loadTestsFromName
(
name
,
return
super
(
ERP5TypeTestReLoader
,
self
).
loadTestsFromName
(
name
,
module
)
module
)
...
@@ -179,7 +181,7 @@ class ERP5TypeTestReLoader(ERP5TypeTestLoader):
...
@@ -179,7 +181,7 @@ class ERP5TypeTestReLoader(ERP5TypeTestLoader):
If the module is not a ZODB Component, then reload it to consider
If the module is not a ZODB Component, then reload it to consider
modifications on the filesystem
modifications on the filesystem
"""
"""
if
not
instance
(
module
,
ComponentDynamicPackage
):
if
not
i
si
nstance
(
module
,
ComponentDynamicPackage
):
reload
(
module
)
reload
(
module
)
return
super
(
ERP5TypeTestReLoader
,
self
).
loadTestsFromModule
(
module
)
return
super
(
ERP5TypeTestReLoader
,
self
).
loadTestsFromModule
(
module
)
...
...
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
272ac2f7
...
@@ -1848,10 +1848,103 @@ class TestDocumentWithImport(TestDocumentImported):
...
@@ -1848,10 +1848,103 @@ class TestDocumentWithImport(TestDocumentImported):
self
.
assertModuleImportable
(
'TestDocumentWithImport'
)
self
.
assertModuleImportable
(
'TestDocumentWithImport'
)
self
.
assertModuleImportable
(
'TestDocumentImported'
)
self
.
assertModuleImportable
(
'TestDocumentImported'
)
from
Products.ERP5Type.Core.TestComponent
import
TestComponent
class
TestZodbTestComponent
(
_TestZodbComponent
):
def
_newComponent
(
self
,
reference
,
text_content
,
version
=
'erp5'
):
return
self
.
_component_tool
.
newContent
(
id
=
'%s.%s.%s'
%
(
self
.
_getComponentModuleName
(),
version
+
'_version'
,
reference
),
reference
=
reference
,
version
=
version
,
text_content
=
text_content
,
portal_type
=
'Test Component'
)
def
_getComponentModuleName
(
self
):
return
TestComponent
.
_getDynamicModuleNamespace
()
def
testRunLiveTest
(
self
):
source_code
=
'''
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
class Test(ERP5TypeTestCase):
def getTitle(self):
return "SampleTest"
def getBusinessTemplateList(self):
return ('erp5_core',)
def _setUpDummyMailHost(self):
"""
Dummy mail host has already been set up when running tests
"""
pass
def _restoreMailHost(self):
"""
Dummy mail host has already been set up when running tests
"""
pass
def test_01_sampleTest(self):
self.assertEqual(0, 0)
'''
component
=
self
.
_newComponent
(
'testRunLiveTest'
,
source_code
)
component
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEqual
(
component
.
getValidationState
(),
'validated'
)
self
.
assertModuleImportable
(
'testRunLiveTest'
)
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
# ERP5TypeLiveTestCase.runLiveTest patches ERP5TypeTestCase bases, thus it
# needs to be restored after calling runLiveTest
base_tuple
=
ERP5TypeTestCase
.
__bases__
try
:
self
.
_component_tool
.
runLiveTest
(
'testRunLiveTest'
)
finally
:
ERP5TypeTestCase
.
__bases__
=
base_tuple
# assertRegexpMatches is only available from Python >= 2.7
import
re
output
=
self
.
_component_tool
.
readTestOutput
()
self
.
assertNotEqual
(
re
.
search
(
'Ran 1 test.*OK'
,
output
,
re
.
DOTALL
),
None
,
"Expected 'Ran 1 test.*OK' in '%s'"
%
output
)
source_code
+=
'''
def test_02_sampleTestWithFailure(self):
self.assertEqual(0, 1)
'''
component
.
setTextContent
(
source_code
)
transaction
.
commit
()
self
.
tic
()
self
.
assertEqual
(
component
.
getValidationState
(),
'validated'
)
self
.
assertModuleImportable
(
'testRunLiveTest'
)
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
base_tuple
=
ERP5TypeTestCase
.
__bases__
try
:
self
.
_component_tool
.
runLiveTest
(
'testRunLiveTest'
)
finally
:
ERP5TypeTestCase
.
__bases__
=
base_tuple
# assertRegexpMatches is only available from Python >= 2.7
import
re
output
=
self
.
_component_tool
.
readTestOutput
()
expected_msg_re_str
=
'Ran 2 tests.*FAILED
\
(
f
ailures=1
\
)
'
self.assertNotEqual(re.search(expected_msg_re_str, output, re.DOTALL), None,
"Expected '
%
s
' in '
%
s
'" % (expected_msg_re_str, output))
def test_suite():
def test_suite():
suite = unittest.TestSuite()
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPortalTypeClass))
suite.addTest(unittest.makeSuite(TestPortalTypeClass))
suite.addTest(unittest.makeSuite(TestZodbPropertySheet))
suite.addTest(unittest.makeSuite(TestZodbPropertySheet))
suite.addTest(unittest.makeSuite(TestZodbExtensionComponent))
suite.addTest(unittest.makeSuite(TestZodbExtensionComponent))
suite.addTest(unittest.makeSuite(TestZodbDocumentComponent))
suite.addTest(unittest.makeSuite(TestZodbDocumentComponent))
suite.addTest(unittest.makeSuite(TestZodbTestComponent))
return suite
return suite
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