Add a --lint-only flag to the tests command.

This commit is contained in:
Eric Snow 2018-03-05 21:07:29 +00:00
parent e6d8a32942
commit ab903400c7
2 changed files with 11 additions and 4 deletions

View file

@ -11,7 +11,7 @@ depends:
.PHONY: lint
lint:
$(PYTHON) -m flake8 --ignore E24,E121,E123,E125,E126,E221,E226,E266,E704,E265 --exclude ptvsd/pydevd $(CURDIR)
$(PYTHON) -m tests --lint-only
.PHONY: test
test: ## Run the test suite.

View file

@ -13,6 +13,7 @@ def convert_argv(argv):
help = False
quick = False
lint = False
runtests = True
args = []
modules = set()
for arg in argv:
@ -25,6 +26,10 @@ def convert_argv(argv):
elif arg == '--lint':
lint = True
continue
elif arg == '--lint-only':
lint = True
runtests = False
continue
# Unittest's main has only flags and positional args.
# So we don't worry about options with values.
@ -60,7 +65,7 @@ def convert_argv(argv):
'--top-level-directory', PROJECT_ROOT,
'--start-directory', start,
]
return cmd + args, lint
return cmd + args, runtests, lint
def fix_sys_path():
@ -88,8 +93,10 @@ def check_lint():
if __name__ == '__main__':
argv, lint = convert_argv(sys.argv[1:])
argv, runtests, lint = convert_argv(sys.argv[1:])
fix_sys_path()
if lint:
check_lint()
unittest.main(module=None, argv=argv)
if runtests:
print('running tests...')
unittest.main(module=None, argv=argv)