From 87c307d792819a0e87d931f278897aa268e937e8 Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 5 May 2020 13:15:22 +0200 Subject: [PATCH] is_test_contract: fix bug if crytic-compile is not used --- slither/utils/tests_pattern.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slither/utils/tests_pattern.py b/slither/utils/tests_pattern.py index fb36934c6..52b2cc105 100644 --- a/slither/utils/tests_pattern.py +++ b/slither/utils/tests_pattern.py @@ -42,5 +42,8 @@ def is_test_contract(contract: "Contract") -> bool: return ( _is_test_pattern(contract.name, "Test") or _is_test_pattern(contract.name, "Mock") - or is_test_file(Path(contract.source_mapping["filename_absolute"])) + or ( + contract.source_mapping["filename_absolute"] + and is_test_file(Path(contract.source_mapping["filename_absolute"])) + ) )