diff --git a/tests/layer_tests/ovc_python_api_tests/test_pytorch.py b/tests/layer_tests/ovc_python_api_tests/test_pytorch.py index bbc4ddda62de9f..8fea30c5f2687f 100644 --- a/tests/layer_tests/ovc_python_api_tests/test_pytorch.py +++ b/tests/layer_tests/ovc_python_api_tests/test_pytorch.py @@ -1181,11 +1181,13 @@ def relu_bad(n): def test_failed_extension(self): import tempfile + import os from openvino.tools.ovc import convert_model with self.assertRaisesRegex(Exception, ".*Cannot recognize input model.*"): - with tempfile.NamedTemporaryFile() as tmpfile: + with tempfile.NamedTemporaryFile(delete=False) as tmpfile: convert_model(tmpfile.name) + os.remove(tmpfile.name) def create_model_three_inputs():