-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (45 loc) · 2.58 KB
/
Copy pathMakefile
File metadata and controls
55 lines (45 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Top-level project Makefile. Standard targets:
# make test fast tier only (the pytest.ini default: -m "not slow"); what CI runs
# make test-full the entire suite incl. the slow tier (end-to-end VCF parsing + est-sfs)
# make docs rebuild the HTML docs from scratch (clean + html)
# make clean remove the built docs
#
# The slow tier (marked `slow` in the tests) is the end-to-end VCF parsing/annotation and
# est-sfs binary comparisons; many of its tests also skip when their large fixtures are
# absent. Tests are meant to run in the `dev-sfsutils` conda env (see envs/dev.yaml).
# Run in the `dev-sfsutils` env by default: the caplog tests need its pytest >= 9.1, and a
# base-env `pytest` on PATH reports them as spurious failures. Override with e.g. `make test
# PYTEST=pytest` to use whatever is active.
PYTEST ?= $(shell conda run -n dev-sfsutils which pytest 2>/dev/null || echo pytest)
# Always run tests in parallel via pytest-xdist. Override e.g. `make test XDIST="-n 4"`
# or disable with `make test XDIST=""` for a serial run (useful when debugging).
XDIST ?= -n auto
.PHONY: help test test-full test-r coverage docs clean
help:
@echo "Targets:"
@echo " make test # fast tier (default: -m 'not slow'); what CI runs"
@echo " make test-full # entire suite incl. the slow tier"
@echo " make coverage # slow tests on committed data only (-m 'not very_slow'), with coverage report"
@echo " make test-r # R wrapper plotting tests (needs the r-sfsutils env; see envs/r.yaml)"
@echo " make docs # rebuild HTML docs from scratch (clean + html)"
@echo " make clean # remove the built docs"
test:
$(PYTEST) $(XDIST)
test-full:
$(PYTEST) $(XDIST) -m "slow or not slow"
# Coverage over everything except the `very_slow` tier (tests whose data/binaries are not
# committed). Runs the fast tier plus the slow tests that work on committed fixtures.
coverage:
$(PYTEST) --cov=sfsutils --cov-report=xml --cov-report=term-missing -m "not very_slow" testing/
# R wrapper tests via reticulate. Point RETICULATE_PYTHON at a Python with sfsutils installed
# (e.g. the dev-sfsutils env) and install the R package first (`R CMD INSTALL .`); see envs/r.yaml.
RETICULATE_PYTHON ?= $(shell conda run -n dev-sfsutils which python 2>/dev/null || which python)
test-r:
RETICULATE_PYTHON=$(RETICULATE_PYTHON) Rscript -e 'testthat::test_dir("tests/testthat")'
# --- docs (Sphinx + myst-nb; notebooks are not executed, nb_execution_mode='off') ---
docs:
$(MAKE) -C docs clean
$(MAKE) -C docs html
@echo "Docs built -> docs/_build/html/index.html"
clean:
$(MAKE) -C docs clean