flask-dashboard / Flask-MonitoringDashboard

Automatically monitor the evolving performance of Flask/Python web services.
http://flask-monitoringdashboard.readthedocs.io/
MIT License
767 stars 159 forks source link

Running tests with the `python setup.py test` doesn't work #355

Open dejagersh opened 4 years ago

dejagersh commented 4 years ago

I am trying to run the tests locally but the command python setup.py test (as described in the docs) results in the following error:

get_test_suite (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: get_test_suite (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: get_test_suite
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
ModuleNotFoundError: No module named 'tests.get_test_suite'

Looking at the Github workflow, I see pytest is used, not python setup.py test. This still gives an error:

___________________________________________________________________ ERROR collecting flask_monitoringdashboard/frontend/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py ____________________________________________________________________
venv/lib/python3.7/site-packages/_pytest/python.py:511: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
venv/lib/python3.7/site-packages/py/_path/local.py:704: in pyimport
    __import__(modname)
E     File "/Users/johan/Projects/Flask-MonitoringDashboard/flask_monitoringdashboard/frontend/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 37
E       print '%s:%s:%d:%s %s' % (mode.upper(), os.path.basename(ctx[0]),
E                            ^
E   SyntaxError: invalid syntax

Any ideas?

dejagersh commented 4 years ago

I think I got it. I just noticed that the errors are occurring in flask_monitoringdashboard/frontend/node_modules and tried:

pytest --ignore=flask_monitoringdashboard/frontend

This seems to work!

dejagersh commented 4 years ago

Is this something to change in the docs? To me it seems like it's out of date :) or did I forget something?