From a9e68af8e85500debac8436336e54da694e745f5 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 16 Aug 2015 13:05:50 -0400 Subject: More informative error message if can't find static files --- coverage/html.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'coverage/html.py') diff --git a/coverage/html.py b/coverage/html.py index 6d1bb43..c0dfe80 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -39,15 +39,22 @@ def data_filename(fname, pkgdir=""): is provided, at that sub-directory. """ + tried = [] for static_dir in STATIC_PATH: static_filename = os.path.join(static_dir, fname) if os.path.exists(static_filename): return static_filename + else: + tried.append(static_filename) if pkgdir: static_filename = os.path.join(static_dir, pkgdir, fname) if os.path.exists(static_filename): return static_filename - raise CoverageException("Couldn't find static file %r" % fname) + else: + tried.append(static_filename) + raise CoverageException( + "Couldn't find static file %r from %r, tried: %r" % (fname, os.getcwd(), tried) + ) def data(fname): -- cgit v1.2.1