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.
This commit is contained in:
Alex Ford
2022-10-12 14:14:00 -07:00
parent e15f51ecc1
commit 4d1e00c3ab

View File

@@ -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