From 2da827462e0f5646e961450a8421e7de72f4da24 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 7 Sep 2016 11:37:21 +0200 Subject: [PATCH] Add a test to make sure check_coverage files exist --- tests/unit/scripts/test_check_coverage.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/unit/scripts/test_check_coverage.py b/tests/unit/scripts/test_check_coverage.py index 15a65a751..ba1357d41 100644 --- a/tests/unit/scripts/test_check_coverage.py +++ b/tests/unit/scripts/test_check_coverage.py @@ -19,6 +19,7 @@ # along with qutebrowser. If not, see . import sys +import os.path import pytest @@ -177,3 +178,19 @@ def test_skipped_args(covtest, args, reason): def test_skipped_windows(covtest, monkeypatch): monkeypatch.setattr('scripts.dev.check_coverage.sys.platform', 'toaster') covtest.check_skipped([], "on non-Linux system.") + + +def _generate_files(): + """Get filenames from WHITELISTED_/PERFECT_FILES.""" + yield from iter(check_coverage.WHITELISTED_FILES) + for test_file, src_file in check_coverage.PERFECT_FILES: + if test_file is not None: + yield test_file + yield src_file + + +@pytest.mark.parametrize('filename', list(_generate_files())) +def test_files_exist(filename): + basedir = os.path.join(os.path.dirname(check_coverage.__file__), + os.pardir, os.pardir) + assert os.path.exists(os.path.join(basedir, filename))