Commit 50328a31 authored by Iliya Manolov's avatar Iliya Manolov Committed by Eteri

Added tests for required eggs in Jupyter

Clone of nexedi/erp5!339

/reviewed-on nexedi/erp5!391
parent 455d95f6
......@@ -1011,4 +1011,46 @@ 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 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