diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..00b1dea --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 88 +ignore = E501, E203 # line length, whitespace before ':' diff --git a/gdbgui/statemanager.py b/gdbgui/statemanager.py index 8a1e896..e6e4dee 100644 --- a/gdbgui/statemanager.py +++ b/gdbgui/statemanager.py @@ -29,9 +29,10 @@ class StateManager(object): if controller: self.controller_to_client_ids[controller].append(client_id) message = "gdbgui is using existing subprocess with pid %s, " - "originally opened with command %s" % (str( - desired_gdbpid - ), controller.get_subprocess_cmd()) + "originally opened with command %s" % ( + str(desired_gdbpid), + controller.get_subprocess_cmd(), + ) using_existing = True pid = desired_gdbpid else: diff --git a/makefile b/makefile index 0589210..dcc9152 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,7 @@ # run pip install -r dev_requirements.txt before running make test .PHONY: test publish executable test: - # flake8 gdbgui/backend.py --ignore=E121,E123,E126,E128,E501 - python setup.py test + python -m test yarn test yarn build python setup.py checkdocs diff --git a/setup.py b/setup.py index ba7eb80..c355eea 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,7 @@ import io import os -import sys -from setuptools import find_packages, setup, Command +from setuptools import find_packages, setup CURDIR = os.path.abspath(os.path.dirname(__file__)) @@ -25,25 +24,6 @@ VERSION = ( .strip() ) - -class TestCommand(Command): - description = "test task" - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - # import here so dependency error on Flask is not - # raised - from tests import test_app - - sys.exit(test_app.main()) - - setup( name="gdbgui", version=VERSION, @@ -81,7 +61,6 @@ setup( }, extras_require={}, zip_safe=False, - cmdclass={"test": TestCommand}, install_requires=REQUIRED, classifiers=[ "Intended Audience :: Developers", diff --git a/tests/__main__.py b/tests/__main__.py new file mode 100644 index 0000000..9b01cdb --- /dev/null +++ b/tests/__main__.py @@ -0,0 +1,3 @@ +from . import test_app, static_tests + +exit(test_app.main() + static_tests.main() diff --git a/tests/static_tests.py b/tests/static_tests.py new file mode 100644 index 0000000..f0c128d --- /dev/null +++ b/tests/static_tests.py @@ -0,0 +1,18 @@ +import subprocess + + +def run(cmd): + print(f"Running {' '.join(cmd)!r}") + return subprocess.run(cmd).returncode + + +def main(): + files = ["gdbgui", "tests", "setup.py"] + ret = 0 + ret += run(["black", "--check"] + files) + ret += run(["flake8"] + files) + return ret + + +if __name__ == "__main__": + exit(main())