From 344f2d8ce742d3f35d808b379d1d80234e336499 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sun, 29 Nov 2020 14:34:31 +0100 Subject: Make the .txt file optional in functional tests If there is no error reported we don't need an empty file --- pylint/testutils/lint_module_test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pylint/testutils/lint_module_test.py b/pylint/testutils/lint_module_test.py index 6a53007ae..3b864184a 100644 --- a/pylint/testutils/lint_module_test.py +++ b/pylint/testutils/lint_module_test.py @@ -6,6 +6,7 @@ import csv import itertools import platform import sys +from io import StringIO from typing import Tuple import pytest @@ -132,7 +133,10 @@ class LintModuleTest: return missing, unexpected def _open_expected_file(self): - return open(self._test_file.expected_output) + try: + return open(self._test_file.expected_output) + except FileNotFoundError: + return StringIO("") def _open_source_file(self): if self._test_file.base == "invalid_encoded_data": -- cgit v1.2.1