ソースを参照

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.
jim winstead 1 年間 前
コミット
741ff5f1a8
3 ファイル変更4 行追加2 行削除
  1. 1 1
      bin/test.sh
  2. 2 0
      pyproject.toml
  3. 1 1
      tests/mock_server/server.py

+ 1 - 1
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 "$@"

+ 2 - 0
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"

+ 1 - 1
tests/mock_server/server.py

@@ -50,4 +50,4 @@ def redirect_to_static(filename):
 
 
 def start():
-    run(host='localhost', port=8080)
+    run(host='localhost', port=8080, quiet=True)