diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-07-02 08:09:40 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-07-02 08:09:40 -0500 |
commit | 7dbd626b5b32855ed4b8b19c7bd00cd9d31090f4 (patch) | |
tree | f40c381ff722229cd1763ca6ac313c3361a5009f | |
parent | 651476fca6c761b37df04f71bbebbfbe863a524b (diff) | |
parent | 50ebb489852b8c9dd02d08e09375aa00859999bf (diff) | |
download | cryptography-7dbd626b5b32855ed4b8b19c7bd00cd9d31090f4.tar.gz cryptography-7dbd626b5b32855ed4b8b19c7bd00cd9d31090f4.tar.bz2 cryptography-7dbd626b5b32855ed4b8b19c7bd00cd9d31090f4.zip |
Merge pull request #2099 from alex/test-coverage
Improved coverage for tests, handle multiple pytest.mark.supported
-rw-r--r-- | tests/test_interfaces.py | 4 | ||||
-rw-r--r-- | tests/test_utils.py | 4 | ||||
-rw-r--r-- | tests/utils.py | 9 |
3 files changed, 11 insertions, 6 deletions
diff --git a/tests/test_interfaces.py b/tests/test_interfaces.py index 4d571ea6..bdb4a94d 100644 --- a/tests/test_interfaces.py +++ b/tests/test_interfaces.py @@ -36,6 +36,8 @@ class TestVerifyInterface(object): def method(self): """Method with no arguments""" + # Invoke this to ensure the line is covered + NonImplementer().method() with pytest.raises(InterfaceNotImplemented): verify_interface(SimpleInterface, NonImplementer) @@ -51,4 +53,6 @@ class TestVerifyInterface(object): def property(self): """A concrete property""" + # Invoke this to ensure the line is covered + NonImplementer().property verify_interface(SimpleInterface, NonImplementer) diff --git a/tests/test_utils.py b/tests/test_utils.py index 8601d11d..f71264ea 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -85,7 +85,7 @@ def test_check_backend_support_skip(): supported = pretend.stub( kwargs={"only_if": lambda backend: False, "skip_message": "Nope"} ) - item = pretend.stub(keywords={"supported": supported}, + item = pretend.stub(keywords={"supported": [supported]}, funcargs={"backend": True}) with pytest.raises(pytest.skip.Exception) as exc_info: check_backend_support(item) @@ -96,7 +96,7 @@ def test_check_backend_support_no_skip(): supported = pretend.stub( kwargs={"only_if": lambda backend: True, "skip_message": "Nope"} ) - item = pretend.stub(keywords={"supported": supported}, + item = pretend.stub(keywords={"supported": [supported]}, funcargs={"backend": True}) assert check_backend_support(item) is None diff --git a/tests/utils.py b/tests/utils.py index 8be5c1fa..5083d48c 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -53,10 +53,11 @@ def skip_if_empty(backend_list, required_interfaces): def check_backend_support(item): supported = item.keywords.get("supported") if supported and "backend" in item.funcargs: - if not supported.kwargs["only_if"](item.funcargs["backend"]): - pytest.skip("{0} ({1})".format( - supported.kwargs["skip_message"], item.funcargs["backend"] - )) + for mark in supported: + if not mark.kwargs["only_if"](item.funcargs["backend"]): + pytest.skip("{0} ({1})".format( + mark.kwargs["skip_message"], item.funcargs["backend"] + )) elif supported: raise ValueError("This mark is only available on methods that take a " "backend") |