-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
34 lines (26 loc) · 924 Bytes
/
Makefile
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
# Get this file's directory, allows this Makefile to be run on its own or via
# `include` from a root Makefile. From:
# https://www.systutorials.com/how-to-get-a-makefiles-directory-for-including-other-makefiles/
SELF_DIR = $(dir $(lastword $(MAKEFILE_LIST)))
# No Docker image available for this yet. Refer to the CI config to configure this for
# local use.
TEST = poetry run pytest
TESTS_DIR = tests
.PHONY: test test-self test-pdfs
define run_test
cd $(SELF_DIR) && \
$(TEST) $(TESTS_DIR)/$(subst -,_,$(1)).py $(TEST_FLAGS)
endef
ifdef CI
TEST_FLAGS = --verbose
else
TEST_FLAGS =
endif
test: test-self test-pdfs # Runs all tests.
@echo "All tests passed."
# Target names correspond to actual Python test files, with some modifications made, see
# the `run_test` function.
test-self: # Runs tests on the tests themselves.
@$(call run_test,$@)
test-pdfs: # Runs tests on found PDFs.
@$(call run_test,$@)