From f93d8244eac195fcc7577ddf22887052c2b686ab Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 23 Oct 2014 12:07:20 -0700 Subject: filter backends during initial generation to elide tests entirely --- tests/utils.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests/utils.py') diff --git a/tests/utils.py b/tests/utils.py index bc5bc1ea..7b462c2d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -40,8 +40,6 @@ def select_backends(names, backend_list): if names is None: return backend_list split_names = [x.strip() for x in names.split(',')] - # this must be duplicated and then removed to preserve the metadata - # pytest associates. Appending backends to a new list doesn't seem to work selected_backends = [] for backend in backend_list: if backend.name in split_names: -- cgit v1.2.3 From 902d8cfd58de395748d71f449944faa9dbac8725 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 25 Oct 2014 12:22:10 -0700 Subject: move skip_if_empty to separate function for test coverage --- tests/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/utils.py') diff --git a/tests/utils.py b/tests/utils.py index 7b462c2d..acc6c141 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -53,6 +53,15 @@ def select_backends(names, backend_list): ) +def skip_if_empty(backend_list, required_interfaces): + if not backend_list: + pytest.skip( + "No backends provided supply the interface: {0}".format( + ", ".join(iface.__name__ for iface in required_interfaces) + ) + ) + + def check_backend_support(item): supported = item.keywords.get("supported") if supported and "backend" in item.funcargs: -- cgit v1.2.3