test feedback

use global PYTEST_ARGS for nicer, simpler always-on arguments for pytest
This commit is contained in:
Min RK
2021-10-28 23:22:54 +02:00
parent 468aa5e93c
commit 65ce06b116
2 changed files with 14 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ on:
env: env:
# UTF-8 content may be interpreted as ascii and causes errors without this. # UTF-8 content may be interpreted as ascii and causes errors without this.
LANG: C.UTF-8 LANG: C.UTF-8
PYTEST_ADDOPTS: "--verbose --color=yes"
jobs: jobs:
rest-api: rest-api:
@@ -28,8 +29,10 @@ jobs:
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: "3.9" python-version: "3.9"
# in addition to the doc requirements
# the docs *tests* require pre-commit and pytest
- run: | - run: |
pip install -r docs/requirements.txt pytest -e . pip install -r docs/requirements.txt pytest pre-commit -e .
- run: | - run: |
pytest docs/ pytest docs/
@@ -199,10 +202,8 @@ jobs:
fi fi
- name: Run pytest - name: Run pytest
# FIXME: --color=yes explicitly set because:
# https://github.com/actions/runner/issues/241
run: | run: |
pytest -v --maxfail=2 --color=yes --cov=jupyterhub jupyterhub/tests pytest --maxfail=2 --cov=jupyterhub jupyterhub/tests
- name: Run yarn jest test - name: Run yarn jest test
run: | run: |
cd jsx && yarn && yarn test cd jsx && yarn && yarn test

View File

@@ -12,7 +12,7 @@ root = here.parent
def test_rest_api_version(): def test_rest_api_version():
version_py = root.joinpath("jupyterhub", "_version.py") version_py = root.joinpath("jupyterhub", "_version.py")
rest_api_yaml = root.joinpath("docs", "rest-api.yml") rest_api_yaml = root.joinpath("docs", "source", "_static", "rest-api.yml")
ns = {} ns = {}
with version_py.open() as f: with version_py.open() as f:
exec(f.read(), {}, ns) exec(f.read(), {}, ns)
@@ -28,12 +28,18 @@ def test_rest_api_version():
def test_restapi_scopes(): def test_restapi_scopes():
run([sys.executable, "source/rbac/generate-scope-table.py"], cwd=here, check=True) run([sys.executable, "source/rbac/generate-scope-table.py"], cwd=here, check=True)
run( run(
['pre-commit', 'run', 'prettier', '--files', 'rest-api.yml'], ['pre-commit', 'run', 'prettier', '--files', 'source/_static/rest-api.yml'],
cwd=here, cwd=here,
check=False, check=False,
) )
run( run(
["git", "diff", "--exit-code", str(here.joinpath("rest-api.yml"))], [
"git",
"diff",
"--no-pager",
"--exit-code",
str(here.joinpath("source", "_static", "rest-api.yml")),
],
cwd=here, cwd=here,
check=True, check=True,
) )