From 4d1e00c3abf175a567d0c6f221cfd510465979f9 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Wed, 12 Oct 2022 14:14:00 -0700 Subject: [PATCH] Skip if attrs not in target environment. Add check for attrs in test environment and skip if not installed. This is patterned off the existing django tests. --- test/test_inference/test_signature.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test_inference/test_signature.py b/test/test_inference/test_signature.py index 0c1550d8..f3087783 100644 --- a/test/test_inference/test_signature.py +++ b/test/test_inference/test_signature.py @@ -375,6 +375,10 @@ def test_dataclass_signature(Script, skip_pre_python37, start, start_params): ] ) def test_attrs_signature(Script, skip_pre_python37, start, start_params): + has_attrs = bool(Script('import attrs').infer()) + if not has_attrs: + raise pytest.skip("attrs needed in target environment to run this test") + code = dedent(''' name: str foo = 3