From ca6cfb81a2936e1eb3a5bb2ca381c5d446322a40 Mon Sep 17 00:00:00 2001 From: Andris Raugulis Date: Wed, 19 Oct 2016 20:51:57 +0300 Subject: [PATCH] Import mypy configuration script and run scripts (for Python 2.7 and 3.5). Import pytest coverage script. --- .gitignore | 1 + test/coverage.sh | 10 ++++++++++ test/mypy-py2.sh | 10 ++++++++++ test/mypy-py3.sh | 10 ++++++++++ test/mypy.ini | 9 +++++++++ 5 files changed, 40 insertions(+) create mode 100755 test/coverage.sh create mode 100755 test/mypy-py2.sh create mode 100755 test/mypy-py3.sh create mode 100644 test/mypy.ini diff --git a/.gitignore b/.gitignore index 2f836aa..84f8554 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.pyc +./html/ diff --git a/test/coverage.sh b/test/coverage.sh new file mode 100755 index 0000000..28f2010 --- /dev/null +++ b/test/coverage.sh @@ -0,0 +1,10 @@ +#!/bin/sh +_cdir=$(cd -- "$(dirname "$0")" && pwd) +type py.test > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "err: py.test (Python testing framework) not found." + exit 1 +fi +cd -- "${_cdir}/.." +mkdir -p html +py.test -v --cov-report=html:html/coverage --cov=ssh-audit test diff --git a/test/mypy-py2.sh b/test/mypy-py2.sh new file mode 100755 index 0000000..f8e9244 --- /dev/null +++ b/test/mypy-py2.sh @@ -0,0 +1,10 @@ +#!/bin/sh +_cdir=$(cd -- "$(dirname "$0")" && pwd) +type mypy > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "err: mypy (Optional Static Typing for Python) not found." + exit 1 +fi +_htmldir="${_cdir}/../html/mypy-py2" +mkdir -p "${_htmldir}" +mypy --python-version 2.7 --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py" diff --git a/test/mypy-py3.sh b/test/mypy-py3.sh new file mode 100755 index 0000000..0d2dfe5 --- /dev/null +++ b/test/mypy-py3.sh @@ -0,0 +1,10 @@ +#!/bin/sh +_cdir=$(cd -- "$(dirname "$0")" && pwd) +type mypy > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "err: mypy (Optional Static Typing for Python) not found." + exit 1 +fi +_htmldir="${_cdir}/../html/mypy-py3" +mkdir -p "${_htmldir}" +mypy --python-version 3.5 --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py" diff --git a/test/mypy.ini b/test/mypy.ini new file mode 100644 index 0000000..9c0a3e0 --- /dev/null +++ b/test/mypy.ini @@ -0,0 +1,9 @@ +[mypy] +silent_imports = True +disallow_untyped_calls = True +disallow_untyped_defs = True +check_untyped_defs = True +disallow-subclassing-any = True +warn-incomplete-stub = True +warn-redundant-casts = True +