Skip to content

Commit

Permalink
check for typecheck exception
Browse files Browse the repository at this point in the history
  • Loading branch information
NishchayKarle committed Jun 4, 2024
1 parent 9befa4a commit 8591614
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion parsl/tests/unit/test_usage_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ def test_invalid_values(level):
@pytest.mark.parametrize("level", ("abcd", None, bytes(1), 1.0, 1j, object()))
def test_invalid_types(level):
"""Test invalid usage_tracking types."""
with pytest.raises(Exception):
with pytest.raises(Exception) as ex:
Config(usage_tracking=level)

# with typeguard 4.x this is TypeCheckError,
# with typeguard 2.x this is TypeError
# we can't instantiate TypeCheckError if we're in typeguard 2.x environment
# because it does not exist... so check name using strings.
assert ex.type.__name__ in ["TypeCheckError", "TypeError"]

0 comments on commit 8591614

Please sign in to comment.