summaryrefslogtreecommitdiff
path: root/tests/pyreverse
diff options
context:
space:
mode:
authorDudeNr33 <3929834+DudeNr33@users.noreply.github.com>2021-08-08 16:24:00 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-08-09 20:00:57 +0200
commit7572cb8f46982e19fd2205bcb45ddceaf61a65d1 (patch)
tree0cc01570887e3d0d0cbfb4bf9e6b0956645786d5 /tests/pyreverse
parent74aa0d3769702ac6de1fc8ad7b503636fe4d0b2e (diff)
downloadpylint-git-7572cb8f46982e19fd2205bcb45ddceaf61a65d1.tar.gz
Use custom class, as ``dataclasses`` was only introduced in Python 3.7.
NamedTuple is not possible as some tests modify the instance attributes.
Diffstat (limited to 'tests/pyreverse')
-rw-r--r--tests/pyreverse/conftest.py50
1 files changed, 33 insertions, 17 deletions
diff --git a/tests/pyreverse/conftest.py b/tests/pyreverse/conftest.py
index f6a417c33..7852795d3 100644
--- a/tests/pyreverse/conftest.py
+++ b/tests/pyreverse/conftest.py
@@ -1,27 +1,43 @@
-from dataclasses import dataclass, field
-from typing import List, Optional
+from typing import Optional, Tuple
import pytest
-@dataclass
-class PyreverseConfig: # pylint: disable=too-many-instance-attributes
+# This class could and should be replaced with a simple dataclass when support for Python < 3.7 is dropped.
+# A NamedTuple is not possible as some tests need to modify attributes during the test.
+class PyreverseConfig: # pylint: disable=too-many-instance-attributes, too-many-arguments
"""Holds the configuration options for Pyreverse.
The default values correspond to the defaults of the options parser."""
- mode: str = "PUB_ONLY"
- classes: List = field(default_factory=list)
- show_ancestors: Optional[int] = None
- all_ancestors: Optional[bool] = None
- show_associated: Optional[int] = None
- all_associated: Optional[bool] = None
- show_builtin: bool = False
- module_names: Optional[bool] = None
- only_classnames: bool = False
- output_format: str = "dot"
- ignore_list: List = field(default_factory=list)
- project: str = ""
- output_directory: str = ""
+ def __init__(
+ self,
+ mode: str = "PUB_ONLY",
+ classes: Tuple = tuple(),
+ show_ancestors: Optional[int] = None,
+ all_ancestors: Optional[bool] = None,
+ show_associated: Optional[int] = None,
+ all_associated: Optional[bool] = None,
+ show_builtin: bool = False,
+ module_names: Optional[bool] = None,
+ only_classnames: bool = False,
+ output_format: str = "dot",
+ ignore_list: Tuple = tuple(),
+ project: str = "",
+ output_directory: str = "",
+ ):
+ self.mode = mode
+ self.classes = classes
+ self.show_ancestors = show_ancestors
+ self.all_ancestors = all_ancestors
+ self.show_associated = show_associated
+ self.all_associated = all_associated
+ self.show_builtin = show_builtin
+ self.module_names = module_names
+ self.only_classnames = only_classnames
+ self.output_format = output_format
+ self.ignore_list = ignore_list
+ self.project = project
+ self.output_directory = output_directory
@pytest.fixture()