Advertisement
Guest User

Untitled

a guest
Mar 24th, 2022
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.94 KB | None | 0 0
  1. ============================= test session starts ==============================
  2. platform linux -- Python 3.7.12, pytest-7.1.1, pluggy-1.0.0
  3. rootdir: /home/ilyatregubov/moodle-mlbackend-python
  4. plugins: flask-1.2.0
  5. collected 34 items
  6.  
  7. test/test_local.py ...F...F [ 23%]
  8. test/test_webapp.py .......s.ss.......F.F..F.x [100%]
  9.  
  10. =================================== FAILURES ===================================
  11. ______________________________ test_import_export ______________________________
  12.  
  13. def test_import_export():
  14. with temp_id_and_dir() as (import_id, import_dir):
  15. p = run('import', import_id, import_dir, TEST_MODEL)
  16. > assert p.returncode == 0
  17. E assert 1 == 0
  18. E + where 1 = CompletedProcess(args=['python3', '-m', 'moodlemlbackend.import', 'temp_id_and_dir-1648102517-a1ja4JFl', '/home/ilyatr..."Expecting value", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n').returncode
  19.  
  20. test/test_local.py:146: AssertionError
  21. ____________________________ test_import_prediction ____________________________
  22.  
  23. def test_import_prediction():
  24. with temp_id_and_dir() as (import_id, import_dir):
  25. p = run('import', import_id, import_dir, TEST_MODEL)
  26. > assert p.returncode == 0
  27. E assert 1 == 0
  28. E + where 1 = CompletedProcess(args=['python3', '-m', 'moodlemlbackend.import', 'temp_id_and_dir-1648102552-2v-exq1Q', '/home/ilyatr..."Expecting value", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n').returncode
  29.  
  30. test/test_local.py:189: AssertionError
  31. _______________________________ test_evaluation ________________________________
  32.  
  33. client = <FlaskClient <Flask 'webapp'>>
  34.  
  35. def test_evaluation(client):
  36. with temporary_model(client) as (uid, auth):
  37. resp = _evaluation_post(client, uid, headers=auth)
  38. assert resp.status_code == 200
  39. results = json.loads(resp.data)
  40.  
  41. # We just want to know it learnt *something*
  42. for indicator, low, high in (#('auc', 0, 1), # AUC is broken
  43. ('accuracy', 0.7, 1),
  44. ('precision', 0.7, 1),
  45. ('recall', 0.7, 1),
  46. ('f1_score', 0.7, 1),
  47. ('score', 0.7, 1)):
  48. score = results[indicator]
  49. assert score >= low
  50. assert score <= high
  51. log_resp = _evaluationlog_get(client.get,
  52. uniqueid=uid,
  53. > headers=auth)
  54.  
  55. test/test_webapp.py:668:
  56. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  57. test/test_webapp.py:211: in _evaluationlog_get
  58. return get(url_for('evaluationlog'), data=data, **kwargs)
  59. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1129: in get
  60. return self.open(*args, **kw)
  61. ../.local/lib/python3.7/site-packages/flask/testing.py:200: in open
  62. follow_redirects=follow_redirects
  63. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1074: in open
  64. response = self.run_wsgi_app(request.environ, buffered=buffered)
  65. ../.local/lib/python3.7/site-packages/werkzeug/test.py:945: in run_wsgi_app
  66. rv = run_wsgi_app(self.application, environ, buffered=buffered)
  67. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1231: in run_wsgi_app
  68. app_rv = app(environ, start_response)
  69. ../.local/lib/python3.7/site-packages/flask/app.py:2309: in __call__
  70. return self.wsgi_app(environ, start_response)
  71. ../.local/lib/python3.7/site-packages/flask/app.py:2295: in wsgi_app
  72. response = self.handle_exception(e)
  73. ../.local/lib/python3.7/site-packages/flask/app.py:1741: in handle_exception
  74. reraise(exc_type, exc_value, tb)
  75. ../.local/lib/python3.7/site-packages/flask/_compat.py:35: in reraise
  76. raise value
  77. ../.local/lib/python3.7/site-packages/flask/app.py:2292: in wsgi_app
  78. response = self.full_dispatch_request()
  79. ../.local/lib/python3.7/site-packages/flask/app.py:1815: in full_dispatch_request
  80. rv = self.handle_user_exception(e)
  81. ../.local/lib/python3.7/site-packages/flask/app.py:1718: in handle_user_exception
  82. reraise(exc_type, exc_value, tb)
  83. ../.local/lib/python3.7/site-packages/flask/_compat.py:35: in reraise
  84. raise value
  85. ../.local/lib/python3.7/site-packages/flask/app.py:1813: in full_dispatch_request
  86. rv = self.dispatch_request()
  87. ../.local/lib/python3.7/site-packages/flask/app.py:1799: in dispatch_request
  88. return self.view_functions[rule.endpoint](**req.view_args)
  89. moodlemlbackend/webapp/access.py:118: in access_wrapper
  90. return f(*args, **kwargs)
  91. moodlemlbackend/webapp/localfs.py:83: in wrapper
  92. return f(*args, **kwargs)
  93. webapp.py:111: in evaluationlog
  94. modeldir = storage.get_model_dir('dirhash')
  95. moodlemlbackend/webapp/localfs.py:29: in get_model_dir
  96. uniquemodelid = get_request_value('uniqueid')
  97. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  98.  
  99. key = 'uniqueid', pattern = '[^A-Za-z0-9_\\-$]', exception = True
  100.  
  101. def get_request_value(key, pattern=False, exception=True):
  102.  
  103. if pattern is False:
  104. pattern = r'[^A-Za-z0-9_\-$]'
  105.  
  106. value = request.values.get(key)
  107. if value is None:
  108.  
  109. if exception is True:
  110. > raise Exception('The requested key ' + key + ' is not available.')
  111. E Exception: The requested key uniqueid is not available.
  112.  
  113. moodlemlbackend/webapp/util.py:20: Exception
  114. _________________________ test_evaluationlog_no_model __________________________
  115.  
  116. client = <FlaskClient <Flask 'webapp'>>
  117.  
  118. def test_evaluationlog_no_model(client):
  119. auth = _auth('kaka')
  120. resp = _evaluationlog_get(client.get,
  121. > headers=auth,
  122. )
  123.  
  124. test/test_webapp.py:682:
  125. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  126. test/test_webapp.py:211: in _evaluationlog_get
  127. return get(url_for('evaluationlog'), data=data, **kwargs)
  128. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1129: in get
  129. return self.open(*args, **kw)
  130. ../.local/lib/python3.7/site-packages/flask/testing.py:200: in open
  131. follow_redirects=follow_redirects
  132. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1074: in open
  133. response = self.run_wsgi_app(request.environ, buffered=buffered)
  134. ../.local/lib/python3.7/site-packages/werkzeug/test.py:945: in run_wsgi_app
  135. rv = run_wsgi_app(self.application, environ, buffered=buffered)
  136. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1231: in run_wsgi_app
  137. app_rv = app(environ, start_response)
  138. ../.local/lib/python3.7/site-packages/flask/app.py:2309: in __call__
  139. return self.wsgi_app(environ, start_response)
  140. ../.local/lib/python3.7/site-packages/flask/app.py:2295: in wsgi_app
  141. response = self.handle_exception(e)
  142. ../.local/lib/python3.7/site-packages/flask/app.py:1741: in handle_exception
  143. reraise(exc_type, exc_value, tb)
  144. ../.local/lib/python3.7/site-packages/flask/_compat.py:35: in reraise
  145. raise value
  146. ../.local/lib/python3.7/site-packages/flask/app.py:2292: in wsgi_app
  147. response = self.full_dispatch_request()
  148. ../.local/lib/python3.7/site-packages/flask/app.py:1815: in full_dispatch_request
  149. rv = self.handle_user_exception(e)
  150. ../.local/lib/python3.7/site-packages/flask/app.py:1718: in handle_user_exception
  151. reraise(exc_type, exc_value, tb)
  152. ../.local/lib/python3.7/site-packages/flask/_compat.py:35: in reraise
  153. raise value
  154. ../.local/lib/python3.7/site-packages/flask/app.py:1813: in full_dispatch_request
  155. rv = self.dispatch_request()
  156. ../.local/lib/python3.7/site-packages/flask/app.py:1799: in dispatch_request
  157. return self.view_functions[rule.endpoint](**req.view_args)
  158. moodlemlbackend/webapp/access.py:118: in access_wrapper
  159. return f(*args, **kwargs)
  160. moodlemlbackend/webapp/localfs.py:83: in wrapper
  161. return f(*args, **kwargs)
  162. webapp.py:111: in evaluationlog
  163. modeldir = storage.get_model_dir('dirhash')
  164. moodlemlbackend/webapp/localfs.py:29: in get_model_dir
  165. uniquemodelid = get_request_value('uniqueid')
  166. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  167.  
  168. key = 'uniqueid', pattern = '[^A-Za-z0-9_\\-$]', exception = True
  169.  
  170. def get_request_value(key, pattern=False, exception=True):
  171.  
  172. if pattern is False:
  173. pattern = r'[^A-Za-z0-9_\-$]'
  174.  
  175. value = request.values.get(key)
  176. if value is None:
  177.  
  178. if exception is True:
  179. > raise Exception('The requested key ' + key + ' is not available.')
  180. E Exception: The requested key uniqueid is not available.
  181.  
  182. moodlemlbackend/webapp/util.py:20: Exception
  183. _____________________________ test_export_bad_uid ______________________________
  184.  
  185. client = <FlaskClient <Flask 'webapp'>>
  186.  
  187. def test_export_bad_uid(client):
  188. auth = _auth('kaka')
  189. resp = _export_get(client.get,
  190. uniqueid=BAD_UID,
  191. > headers=auth)
  192.  
  193. test/test_webapp.py:703:
  194. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  195. test/test_webapp.py:314: in _export_get
  196. return get(url_for('export'), data=data, **kwargs)
  197. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1129: in get
  198. return self.open(*args, **kw)
  199. ../.local/lib/python3.7/site-packages/flask/testing.py:200: in open
  200. follow_redirects=follow_redirects
  201. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1074: in open
  202. response = self.run_wsgi_app(request.environ, buffered=buffered)
  203. ../.local/lib/python3.7/site-packages/werkzeug/test.py:945: in run_wsgi_app
  204. rv = run_wsgi_app(self.application, environ, buffered=buffered)
  205. ../.local/lib/python3.7/site-packages/werkzeug/test.py:1231: in run_wsgi_app
  206. app_rv = app(environ, start_response)
  207. ../.local/lib/python3.7/site-packages/flask/app.py:2309: in __call__
  208. return self.wsgi_app(environ, start_response)
  209. ../.local/lib/python3.7/site-packages/flask/app.py:2295: in wsgi_app
  210. response = self.handle_exception(e)
  211. ../.local/lib/python3.7/site-packages/flask/app.py:1741: in handle_exception
  212. reraise(exc_type, exc_value, tb)
  213. ../.local/lib/python3.7/site-packages/flask/_compat.py:35: in reraise
  214. raise value
  215. ../.local/lib/python3.7/site-packages/flask/app.py:2292: in wsgi_app
  216. response = self.full_dispatch_request()
  217. ../.local/lib/python3.7/site-packages/flask/app.py:1815: in full_dispatch_request
  218. rv = self.handle_user_exception(e)
  219. ../.local/lib/python3.7/site-packages/flask/app.py:1718: in handle_user_exception
  220. reraise(exc_type, exc_value, tb)
  221. ../.local/lib/python3.7/site-packages/flask/_compat.py:35: in reraise
  222. raise value
  223. ../.local/lib/python3.7/site-packages/flask/app.py:1813: in full_dispatch_request
  224. rv = self.dispatch_request()
  225. ../.local/lib/python3.7/site-packages/flask/app.py:1799: in dispatch_request
  226. return self.view_functions[rule.endpoint](**req.view_args)
  227. moodlemlbackend/webapp/access.py:118: in access_wrapper
  228. return f(*args, **kwargs)
  229. moodlemlbackend/webapp/localfs.py:83: in wrapper
  230. return f(*args, **kwargs)
  231. webapp.py:125: in export
  232. uniquemodelid = get_request_value('uniqueid')
  233. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  234.  
  235. key = 'uniqueid', pattern = '[^A-Za-z0-9_\\-$]', exception = True
  236.  
  237. def get_request_value(key, pattern=False, exception=True):
  238.  
  239. if pattern is False:
  240. pattern = r'[^A-Za-z0-9_\-$]'
  241.  
  242. value = request.values.get(key)
  243. if value is None:
  244.  
  245. if exception is True:
  246. > raise Exception('The requested key ' + key + ' is not available.')
  247. E Exception: The requested key uniqueid is not available.
  248.  
  249. moodlemlbackend/webapp/util.py:20: Exception
  250. =============================== warnings summary ===============================
  251. test/test_local.py:168
  252. /home/ilyatregubov/moodle-mlbackend-python/test/test_local.py:168: DeprecationWarning: invalid escape sequence \d
  253. assert re.match('^\d+$', result['runid'])
  254.  
  255. ../.local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py:22
  256. /home/ilyatregubov/.local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py:22: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  257. import imp
  258.  
  259. ../.local/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py:1
  260. /home/ilyatregubov/.local/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  261. from collections import Mapping, MutableMapping
  262.  
  263. ../.local/lib/python3.7/site-packages/matplotlib/backend_bases.py:55
  264. ../.local/lib/python3.7/site-packages/matplotlib/backend_bases.py:55
  265. /home/ilyatregubov/.local/lib/python3.7/site-packages/matplotlib/backend_bases.py:55: DeprecationWarning: PILLOW_VERSION is deprecated and will be removed in Pillow 9 (2022-01-02). Use __version__ instead.
  266. from PIL import PILLOW_VERSION
  267.  
  268. -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
  269. =========================== short test summary info ============================
  270. FAILED test/test_local.py::test_import_export - assert 1 == 0
  271. FAILED test/test_local.py::test_import_prediction - assert 1 == 0
  272. FAILED test/test_webapp.py::test_evaluation - Exception: The requested key un...
  273. FAILED test/test_webapp.py::test_evaluationlog_no_model - Exception: The requ...
  274. FAILED test/test_webapp.py::test_export_bad_uid - Exception: The requested ke...
  275. == 5 failed, 25 passed, 3 skipped, 1 xfailed, 5 warnings in 162.52s (0:02:42) ==
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement