From 741ff5f1a864ab6833ed98da5ff7a3be79cbee52 Mon Sep 17 00:00:00 2001 From: jim winstead Date: Fri, 1 Mar 2024 12:43:53 -0800 Subject: [PATCH] Make it a little easier to run specific tests Changes ./bin/test.sh to pass command line options to pytest, and default to only running tests in the tests/ directory instead of everywhere excluding a few directories which is more error-prone. Also keeps the mock_server used in testing quiet so access log entries don't appear on stdout. --- bin/test.sh | 2 +- pyproject.toml | 2 ++ tests/mock_server/server.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/test.sh b/bin/test.sh index f9ea3575..515806bb 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -14,4 +14,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )" source "$DIR/.venv/bin/activate" -pytest -s --basetemp=tests/out --ignore=archivebox/vendor --ignore=deb_dist --ignore=pip_dist --ignore=brew_dist +pytest -s --basetemp=tests/out "$@" diff --git a/pyproject.toml b/pyproject.toml index 0907858b..f5f7dc4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,6 +107,8 @@ lint = "./bin/lint.sh" test = "./bin/test.sh" # all = {composite = ["lint mypackage/", "test -v tests/"]} +[tool.pytest.ini_options] +testpaths = [ "tests" ] [project.scripts] archivebox = "archivebox.cli:main" diff --git a/tests/mock_server/server.py b/tests/mock_server/server.py index 4283574f..39abd80c 100644 --- a/tests/mock_server/server.py +++ b/tests/mock_server/server.py @@ -50,4 +50,4 @@ def redirect_to_static(filename): def start(): - run(host='localhost', port=8080) \ No newline at end of file + run(host='localhost', port=8080, quiet=True)