From 5d7eb2285d3c1024214e2bb42ab66e822a8932bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sun, 5 Jan 2020 20:50:14 +0100 Subject: [PATCH] :wrench: Update tests tools --- pyproject.toml | 2 ++ scripts/test-files.sh | 10 ++++++++++ scripts/test.sh | 7 ++++--- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100755 scripts/test-files.sh diff --git a/pyproject.toml b/pyproject.toml index d72b45d..2744d5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,8 @@ test = [ "pytest >=4.0.0", "pytest-cov", "coverage", + "pytest-xdist", + "pytest-sugar", "mypy", "black", "isort" diff --git a/scripts/test-files.sh b/scripts/test-files.sh new file mode 100755 index 0000000..a282741 --- /dev/null +++ b/scripts/test-files.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e +set -x + +# Check README.md is up to date +diff --brief docs/index.md README.md +# Check copy paste errors in tutorials +if grep -r --include "*.md" "Usage: tutorial" ./docs ; then echo "Incorrect console demo"; exit 1 ; fi +if grep -r --include "*.md" "python tutorial" ./docs ; then echo "Incorrect console demo"; exit 1 ; fi diff --git a/scripts/test.sh b/scripts/test.sh index 5440f2c..461e294 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -4,7 +4,8 @@ set -e set -x export PYTHONPATH=./docs/src -pytest --cov=typer --cov=tests --cov=docs/src --cov-report=term-missing ${@} +# Use xdist-pytest --forked to ensure modified sys.path to import relative modules in examples keeps working +pytest --cov=typer --cov=tests --cov=docs/src --cov-report=term-missing -o console_output_style=progress --forked --numprocesses=auto ${@} bash ./scripts/lint.sh -# Check README.md is up to date -diff --brief docs/index.md README.md +# Include tests for files +bash ./scripts/test-files.sh