Skip to content

Commit

Permalink
[#34] add test for black import failures
Browse files Browse the repository at this point in the history
Signed-off-by: Bryant Finney <bryant.finney@alumni.uah.edu>
  • Loading branch information
bryant-finney committed Nov 21, 2021
1 parent ce205cc commit 792aafd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/setup_updater_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,15 @@ def test_black(): # type: () -> None
is_black = setup_updater._get_formatting_module()

assert is_black is black


def test_not_black(monkeypatch, dummy_import): # type: (MonkeyPatch, Callable) -> None
"""
verify `black` import failures provide an alternative formatter (or None)
"""
import black

monkeypatch.setattr("builtins.__import__", dummy_import)
is_not_black = setup_updater._get_formatting_module()

assert is_not_black is not black

0 comments on commit 792aafd

Please sign in to comment.