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
Iliya Manolov
erp5
Commits
0ec51b6e
Commit
0ec51b6e
authored
Aug 07, 2017
by
Iliya Manolov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[jupyter] Added tests for required eggs
parent
583ed6e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py
...ateItem/portal_components/test.erp5.testExecuteJupyter.py
+46
-1
No files found.
bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py
View file @
0ec51b6e
...
...
@@ -72,6 +72,23 @@ class TestExecuteJupyter(ERP5TypeTestCase):
notebook_code
=
notebook_code
,
batch_mode
=
True
)
def
checkEgg
(
self
,
import_code
):
'''
Returns whether an egg is available.
'''
reference
=
'Test.Notebook.EnvironmentObject.Errors.EggImport'
result
=
self
.
portal
.
Base_executeJupyter
(
reference
=
reference
,
python_expression
=
import_code
)
self
.
tic
()
result
=
json
.
loads
(
result
)
return
result
[
'status'
]
==
'ok'
def
testJupyterCompileErrorRaise
(
self
):
"""
...
...
@@ -990,4 +1007,32 @@ print os.path
self
.
tic
()
result
=
json
.
loads
(
result
)
self
.
assertEquals
(
result
[
'status'
],
'ok'
)
\ No newline at end of file
self
.
assertEquals
(
result
[
'status'
],
'ok'
)
def
testEggs
(
self
):
'''
Test whether essential modules are available.
'''
self
.
login
(
'dev_user'
)
egg_list
=
[
'scipy'
,
'sklearn'
,
'pandas'
,
'matplotlib'
,
'math'
,
'sympy'
,
'pylab'
,
'openpyxl'
,
'statsmodels'
,
'datetime'
,
'h5py'
]
result_dict
=
{}
final_output
=
'The following eggs can not be imported by Jupyter: '
noErrors
=
True
for
egg
in
egg_list
:
result_dict
[
egg
]
=
(
self
.
checkEgg
(
'import %s as _'
%
egg
))
noErrors
=
result_dict
[
egg
]
and
noErrors
if
noErrors
:
final_output
=
'Success'
else
:
for
egg
,
result
in
result_dict
.
iteritems
():
if
result
is
False
:
final_output
+=
(
'%s, '
%
egg
)
final_output
=
final_output
[:
-
2
]
self
.
assertEquals
(
final_output
,
'Success'
)
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