-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(markers): add tests for custom markers
I had a thought about a potential edge case with `None` being the only listed "Exception" in a `raises` argument. This fixes the edge case and also adds some simple tests to make sure our custom markers correctly handle when an imported backend exception is set to `None` due to a missing import.
- Loading branch information
Showing
2 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
from ibis.backends.base import _get_backend_names | ||
|
||
all_backends = list(_get_backend_names()) | ||
|
||
|
||
@pytest.mark.notimpl(all_backends) | ||
def test_notimpl(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.notimpl(all_backends, raises=None) | ||
def test_notimpl_raises_none(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.notimpl(all_backends, raises=(None, None)) | ||
def test_notimpl_raises_none_tuple(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.notimpl(all_backends, raises=(Exception, None)) | ||
def test_notimpl_raises_tuple_exception_none(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.notyet(all_backends) | ||
def test_notyet(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.notyet(all_backends, raises=None) | ||
def test_notyet_raises_none(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.notyet(all_backends, raises=(None, None)) | ||
def test_notyet_raises_none_tuple(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.notyet(all_backends, raises=(Exception, None)) | ||
def test_notyet_raises_tuple_exception_none(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.never(all_backends, reason="because I said so") | ||
def test_never(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.never(all_backends, raises=None, reason="because I said so") | ||
def test_never_raises_none(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.never(all_backends, raises=(None, None), reason="because I said so") | ||
def test_never_raises_none_tuple(con): | ||
raise Exception | ||
|
||
|
||
@pytest.mark.never(all_backends, raises=(Exception, None), reason="because I said so") | ||
def test_never_raises_tuple_exception_none(con): | ||
raise Exception |