From f35d96bf211243b79cd154963f77bd0aa05bda7f Mon Sep 17 00:00:00 2001 From: Will Kahn-Greene Date: Thu, 9 Nov 2017 12:06:37 -0500 Subject: [PATCH] Fail hard with tracebacks if pytest-expect isn't working Fixes #329 --- html5lib/tests/conftest.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/html5lib/tests/conftest.py b/html5lib/tests/conftest.py index ce93eff6..dad167c5 100644 --- a/html5lib/tests/conftest.py +++ b/html5lib/tests/conftest.py @@ -1,4 +1,6 @@ +from __future__ import print_function import os.path +import sys import pkg_resources import pytest @@ -15,6 +17,26 @@ _sanitizer_testdata = os.path.join(_dir, "sanitizer-testdata") +def fail_if_missing_pytest_expect(): + """Throws an exception halting pytest if pytest-expect isn't working""" + try: + from pytest_expect import expect # noqa + except ImportError: + header = '*' * 78 + print( + '\n' + + header + '\n' + + 'ERROR: Either pytest-expect or its dependency u-msgpack-python is not\n' + + 'installed. Please install them both before running pytest.\n' + + header + '\n', + file=sys.stderr + ) + raise + + +fail_if_missing_pytest_expect() + + def pytest_configure(config): msgs = [] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy