consolidate reporting

pull/114/head
Nicholas Bollweg 2023-04-10 07:51:49 -05:00
rodzic dd3283331d
commit ee50b53aeb
6 zmienionych plików z 50 dodań i 78 usunięć

Wyświetl plik

@ -102,6 +102,7 @@ dependencies:
- ssort
# unit testing
- pytest
- pytest-cov
- pytest-console-scripts
- pytest-html
- pytest-jupyter-server

Wyświetl plik

@ -50,6 +50,7 @@ dependencies:
- ssort
# unit testing
- pytest
- pytest-cov
- pytest-console-scripts
- pytest-html
- pytest-jupyter-server

Wyświetl plik

@ -296,21 +296,13 @@ jobs:
cd ../ipydrawio-mathjax
codecov --root ../..
- name: upload (utest)
- name: upload (reports)
if: always()
uses: actions/upload-artifact@v3
with:
name: |-
ipydrawio-${{ github.run_number }}-utest-${{ matrix.os }}-${{ matrix.python-version }}
path: ./build/pytest
- name: upload (atest)
if: always()
uses: actions/upload-artifact@v3
with:
name: |-
ipydrawio-${{ github.run_number }}-atest-${{ matrix.os }}-${{matrix.python-version }}
path: ./build/atest
ipydrawio-${{ github.run_number }}-reports-${{ matrix.os }}-${{matrix.python-version }}
path: ./build/reports
- name: Rename uncached conda packages
shell: bash
@ -430,12 +422,12 @@ jobs:
shell: bash -l {0}
run: doit test:robot
- name: upload (atest)
- name: upload (reports)
if: always()
uses: actions/upload-artifact@v3
with:
name: |-
ipydrawio-${{ github.run_number }}-atest-${{ matrix.os }}${{ matrix.python-version }}
ipydrawio-${{ github.run_number }}-reports-${{ matrix.os }}${{ matrix.python-version }}
path: ./build/atest
- name: upload (docs)

Wyświetl plik

@ -73,6 +73,7 @@ dependencies:
- ssort
# unit testing
- pytest
- pytest-cov
- pytest-console-scripts
- pytest-html
- pytest-jupyter-server

47
dodo.py
Wyświetl plik

@ -942,14 +942,10 @@ def task_provision():
)
def _pytest(setup_py, pycov_args, pytest_args):
def _pytest(setup_py, pytest_args):
return CmdAction(
[
*P.PYM,
"coverage",
"run",
*pycov_args,
"-m",
"pytest",
*P.PYTEST_ARGS,
*pytest_args,
@ -963,30 +959,6 @@ def _pytest(setup_py, pycov_args, pytest_args):
)
def _pycov_combine(setup_py):
return CmdAction(
[*P.PYM, "coverage", "combine"],
shell=False,
cwd=str(setup_py.parent),
)
def _pycov_report(setup_py):
return CmdAction(
[*P.PYM, "coverage", "report", "--skip-covered", "--show-missing"],
shell=False,
cwd=str(setup_py.parent),
)
def _pycov_html(setup_py, *pycov_html_args):
return CmdAction(
[*P.PYM, "coverage", "html", *pycov_html_args],
shell=False,
cwd=str(setup_py.parent),
)
def task_test():
"""Run tests."""
if not P.TESTING_IN_CI:
@ -1013,8 +985,9 @@ def task_test():
)
for pkg, setup in P.PY_SETUP.items():
html = P.BUILD / f"pytest/{pkg}/test.html"
htmlcov = P.BUILD / f"pytest/{pkg}/htmlcov"
report_dir = P.REPORTS / "pytest" / pkg
html = report_dir / "pytest.html"
cov_index = report_dir / "htmlcov" / "index.html"
pytest_args = [
"-vv",
"--tb=long",
@ -1022,9 +995,10 @@ def task_test():
"--self-contained-html",
"--script-launch-mode=subprocess",
"--cov-context=test",
f"""--cov={pkg.replace("-", "_")}""",
f"--cov-report=html:{cov_index.parent}",
"--cov-branch",
]
pycov_args = []
pycov_html_args = [f"--directory={htmlcov.parent}"]
if pkg == P.IPD.name:
pytest_args += ["-n", "auto"]
@ -1042,12 +1016,9 @@ def task_test():
],
"actions": [
(P.delete_some, [html]),
_pytest(setup, pycov_args, pytest_args),
_pycov_combine(setup),
_pycov_html(setup, *pycov_html_args),
_pycov_report(setup),
_pytest(setup, pytest_args),
],
"targets": [html],
"targets": [html, cov_index],
},
P.OK_PYTEST[pkg],
)

Wyświetl plik

@ -136,6 +136,7 @@ YARN_INTEGRITY = NODE_MODULES / ".yarn-integrity"
YARN_LOCK = ROOT / "yarn.lock"
DODO = ROOT / "dodo.py"
BUILD = ROOT / "build"
REPORTS = BUILD / "reports"
DIST = ROOT / "dist"
DOCS = ROOT / "docs"
README = ROOT / "README.md"
@ -200,7 +201,7 @@ EXAMPLE_IPYNB = _clean(EXAMPLES.rglob("*.ipynb"))
DIST_NBHTML = DIST / "nbsmoke"
ATEST = ROOT / "atest"
ATEST_DIO = _clean(ATEST.rglob("*.dio"), ATEST.rglob("*.dio.svg"))
ATEST_OUT = BUILD / "atest"
ATEST_OUT = REPORTS / "atest"
ATEST_OUT_XML = "output.xml"
ATEST_TEMPLATES = [*ATEST.rglob("*.robot.j2")]
@ -557,32 +558,33 @@ JS_PKG_PACK[IPDM.name][0] += [IPDWP_IGNORE, IPDWP_APP, *ALL_IPDM_JS, IPDM_STARTU
IPYDRAWIO_DATA_DIR = Path(sys.prefix) / "share/jupyter/ipydrawio_export"
# built files
OK_PIP_CHECK = BUILD / "pip.check.ok"
OK_INTEGRITY = BUILD / "integrity.ok"
OK_SUBMODULES = BUILD / "submodules.ok"
OK_BLACK = BUILD / "black.ok"
OK_BLACK_JUPYTER = BUILD / "black.jupyter.ok"
OK_NBQA_RUFF = BUILD / "nbqa.ruff.ok"
OK_RUFF = BUILD / "ruff.ok"
OK_FLAKE8 = BUILD / "flake8.ok"
OK_SSORT = BUILD / "ssort.ok"
OK_LINT = BUILD / "lint.ok"
OK_ROBOTIDY = BUILD / "robot.tidy.ok"
OK_PRETTIER = BUILD / "prettier.ok"
OK_ESLINT = BUILD / "eslint.ok"
OK_JS_BUILD_PRE = BUILD / "js.build.pre.ok"
OK_JS_BUILD = BUILD / "js.build.ok"
OK_PYTEST = {k: BUILD / f"pytest.{k}.ok" for k, v in PY_SETUP.items()}
OK_SERVEREXT = {k: BUILD / f"serverext.{k}.ok" for k, v in SERVER_EXT.items()}
OK_PROVISION = BUILD / "provision.ok"
OK_ROBOT_DRYRUN = BUILD / "robot.dryrun.ok"
OK_ROBOCOP = BUILD / "robot.robocop.ok"
OK_DIOLINT = BUILD / "dio.lint.ok"
OK_ATEST = BUILD / "atest.ok"
OK_CONDA_TEST = BUILD / "conda-build.test.ok"
OK_LINK_CHECK = BUILD / "pytest-check-links.ok"
OK = BUILD / "ok"
OK_PIP_CHECK = OK / "pip.check.ok"
OK_INTEGRITY = OK / "integrity.ok"
OK_SUBMODULES = OK / "submodules.ok"
OK_BLACK = OK / "black.ok"
OK_BLACK_JUPYTER = OK / "black.jupyter.ok"
OK_NBQA_RUFF = OK / "nbqa.ruff.ok"
OK_RUFF = OK / "ruff.ok"
OK_FLAKE8 = OK / "flake8.ok"
OK_SSORT = OK / "ssort.ok"
OK_LINT = OK / "lint.ok"
OK_ROBOTIDY = OK / "robot.tidy.ok"
OK_PRETTIER = OK / "prettier.ok"
OK_ESLINT = OK / "eslint.ok"
OK_JS_BUILD_PRE = OK / "js.build.pre.ok"
OK_JS_BUILD = OK / "js.build.ok"
OK_PYTEST = {k: OK / f"pytest.{k}.ok" for k, v in PY_SETUP.items()}
OK_SERVEREXT = {k: OK / f"serverext.{k}.ok" for k, v in SERVER_EXT.items()}
OK_PROVISION = OK / "provision.ok"
OK_ROBOT_DRYRUN = OK / "robot.dryrun.ok"
OK_ROBOCOP = OK / "robot.robocop.ok"
OK_DIOLINT = OK / "dio.lint.ok"
OK_ATEST = OK / "atest.ok"
OK_CONDA_TEST = OK / "conda-build.test.ok"
OK_LINK_CHECK = OK / "pytest-check-links.ok"
OK_EXT_BUILD = {k: BUILD / f"ext.build.{k}.ok" for k in JS_LABEXT_PY_HOST}
OK_EXT_BUILD = {k: OK / f"ext.build.{k}.ok" for k in JS_LABEXT_PY_HOST}
PY_TEST_DEP.setdefault("ipydrawio-export", []).append(OK_PROVISION)
@ -829,7 +831,11 @@ def _ok(task, ok):
task["actions"] = [
lambda: [ok.exists() and ok.unlink(), True][-1],
*task["actions"],
lambda: [ok.parent.mkdir(exist_ok=True), ok.write_text("ok", **ENC), True][-1],
lambda: [
ok.parent.mkdir(exist_ok=True, parents=True),
ok.write_text("ok", **ENC),
True,
][-1],
]
return task