mirror of
https://github.com/cs01/gdbgui
synced 2024-11-16 07:47:46 +01:00
add static unit tests; move test entrypoint; run black
This commit is contained in:
parent
2bc66225de
commit
f6bad41f05
6 changed files with 30 additions and 27 deletions
3
.flake8
Normal file
3
.flake8
Normal file
|
@ -0,0 +1,3 @@
|
|||
[flake8]
|
||||
max-line-length = 88
|
||||
ignore = E501, E203 # line length, whitespace before ':'
|
|
@ -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:
|
||||
|
|
3
makefile
3
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
|
||||
|
|
23
setup.py
23
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",
|
||||
|
|
3
tests/__main__.py
Normal file
3
tests/__main__.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from . import test_app, static_tests
|
||||
|
||||
exit(test_app.main() + static_tests.main()
|
18
tests/static_tests.py
Normal file
18
tests/static_tests.py
Normal file
|
@ -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())
|
Loading…
Reference in a new issue