Commit 70e85adb authored by Iliya Manolov's avatar Iliya Manolov Committed by Łukasz Nowak

Added tests for required eggs in Jupyter

Clone of nexedi/erp5!339

/reviewed-on nexedi/erp5!391
parent bbb4585e
...@@ -1012,3 +1012,45 @@ print os.path ...@@ -1012,3 +1012,45 @@ print os.path
result = json.loads(result) result = json.loads(result)
self.assertEquals(result['status'], 'ok') self.assertEquals(result['status'], 'ok')
def checkEgg(self, egg):
'''
Returns whether an egg is available.
'''
reference = 'Test.Notebook.EnvironmentObject.Errors.EggImport'
try:
result = self.portal.Base_executeJupyter(
reference=reference,
python_expression='import %s as _' % egg
)
except Exception:
result = json.dumps(dict(status='error'))
self.tic()
result = json.loads(result)
return result['status'] == 'ok'
def testEggs(self):
'''
Test whether essential modules are available.
'''
self.login('dev_user')
egg_list = [
'datetime',
'h5py',
'math',
'matplotlib',
'openpyxl',
'pandas',
'pylab',
'scipy',
'sklearn',
'statsmodels',
'sympy',
]
imported_egg_list = [egg for egg in egg_list if self.checkEgg(egg)]
self.assertEqual(set(egg_list), set(imported_egg_list))
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment