From 859161431df102756869b237e8c526ef1d0ebe44 Mon Sep 17 00:00:00 2001 From: nishchaykarle Date: Tue, 4 Jun 2024 16:16:42 -0500 Subject: [PATCH] check for typecheck exception --- parsl/tests/unit/test_usage_tracking.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parsl/tests/unit/test_usage_tracking.py b/parsl/tests/unit/test_usage_tracking.py index 22cc880b4d..351355811c 100644 --- a/parsl/tests/unit/test_usage_tracking.py +++ b/parsl/tests/unit/test_usage_tracking.py @@ -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"]