Browse Source

pytest: Use the py.test utility if available

The py.test unit test runner offers a number of more advanced features
than simply running using unittest.main. In particular it allows us to
capture a tests output and print it if it fails. This change checks
whether we have pytest available and if yes, enables verbose tests and
runs using pytest. This'll give the usual experience (with colors!)
and show us the stdout if a test fails making travis a lot easier to
handle.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
fc176b6cc0
  1. 6
      Makefile

6
Makefile

@ -29,6 +29,8 @@ ifeq ($(COVERAGE),1)
COVFLAGS = --coverage
endif
PYTEST := $(shell command -v pytest 2> /dev/null)
# This is where we add new features as bitcoin adds them.
FEATURES :=
@ -170,7 +172,11 @@ check:
$(MAKE) pytest
pytest: $(ALL_PROGRAMS)
ifndef PYTEST
PYTHONPATH=contrib/pylightning DEVELOPER=$(DEVELOPER) python3 tests/test_lightningd.py -f
else
PYTHONPATH=contrib/pylightning TEST_DEBUG=1 DEVELOPER=$(DEVELOPER) $(PYTEST) -vx tests/test_lightningd.py
endif
# Keep includes in alpha order.
check-src-include-order/%: %

Loading…
Cancel
Save