diff options
Diffstat (limited to 'pylint/testutils/_primer')
-rw-r--r-- | pylint/testutils/_primer/__init__.py | 4 | ||||
-rw-r--r-- | pylint/testutils/_primer/package_to_lint.py | 11 | ||||
-rw-r--r-- | pylint/testutils/_primer/primer.py | 4 | ||||
-rw-r--r-- | pylint/testutils/_primer/primer_command.py | 12 | ||||
-rw-r--r-- | pylint/testutils/_primer/primer_compare_command.py | 4 | ||||
-rw-r--r-- | pylint/testutils/_primer/primer_prepare_command.py | 11 | ||||
-rw-r--r-- | pylint/testutils/_primer/primer_run_command.py | 10 |
7 files changed, 24 insertions, 32 deletions
diff --git a/pylint/testutils/_primer/__init__.py b/pylint/testutils/_primer/__init__.py index 17c854572..2c40f561b 100644 --- a/pylint/testutils/_primer/__init__.py +++ b/pylint/testutils/_primer/__init__.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt __all__ = ["PackageToLint", "PRIMER_DIRECTORY_PATH"] diff --git a/pylint/testutils/_primer/package_to_lint.py b/pylint/testutils/_primer/package_to_lint.py index d59f93ed5..1f596f02b 100644 --- a/pylint/testutils/_primer/package_to_lint.py +++ b/pylint/testutils/_primer/package_to_lint.py @@ -1,22 +1,17 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations import logging -import sys from pathlib import Path +from typing import Literal from git import GitCommandError from git.cmd import Git from git.repo import Repo -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - PRIMER_DIRECTORY_PATH = Path("tests") / ".pylint_primer_tests" diff --git a/pylint/testutils/_primer/primer.py b/pylint/testutils/_primer/primer.py index 7d08f1df5..abe6bc4dd 100644 --- a/pylint/testutils/_primer/primer.py +++ b/pylint/testutils/_primer/primer.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/pylint/testutils/_primer/primer_command.py b/pylint/testutils/_primer/primer_command.py index bbc930913..817c1a0d3 100644 --- a/pylint/testutils/_primer/primer_command.py +++ b/pylint/testutils/_primer/primer_command.py @@ -1,23 +1,17 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations import abc import argparse -import sys from pathlib import Path -from typing import Dict +from typing import Dict, TypedDict from pylint.reporters.json_reporter import OldJsonExport from pylint.testutils._primer import PackageToLint -if sys.version_info >= (3, 8): - from typing import TypedDict -else: - from typing_extensions import TypedDict - class PackageData(TypedDict): commit: str diff --git a/pylint/testutils/_primer/primer_compare_command.py b/pylint/testutils/_primer/primer_compare_command.py index acc1c9562..b405d7577 100644 --- a/pylint/testutils/_primer/primer_compare_command.py +++ b/pylint/testutils/_primer/primer_compare_command.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations import json diff --git a/pylint/testutils/_primer/primer_prepare_command.py b/pylint/testutils/_primer/primer_prepare_command.py index e69e55b95..27e216bd5 100644 --- a/pylint/testutils/_primer/primer_prepare_command.py +++ b/pylint/testutils/_primer/primer_prepare_command.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations import sys @@ -15,20 +15,21 @@ class PrepareCommand(PrimerCommand): def run(self) -> None: commit_string = "" version_string = ".".join(str(x) for x in sys.version_info[:2]) + # Shorten the SHA to avoid exceeding GitHub's 512 char ceiling if self.config.clone: for package, data in self.packages.items(): local_commit = data.lazy_clone() print(f"Cloned '{package}' at commit '{local_commit}'.") - commit_string += local_commit + "_" + commit_string += local_commit[:8] + "_" elif self.config.check: for package, data in self.packages.items(): local_commit = Repo(data.clone_directory).head.object.hexsha print(f"Found '{package}' at commit '{local_commit}'.") - commit_string += local_commit + "_" + commit_string += local_commit[:8] + "_" elif self.config.make_commit_string: for package, data in self.packages.items(): remote_sha1_commit = ( - Git().ls_remote(data.url, data.branch).split("\t")[0] + Git().ls_remote(data.url, data.branch).split("\t")[0][:8] ) print(f"'{package}' remote is at commit '{remote_sha1_commit}'.") commit_string += remote_sha1_commit + "_" diff --git a/pylint/testutils/_primer/primer_run_command.py b/pylint/testutils/_primer/primer_run_command.py index cd17d6b1d..7fb4a9ea2 100644 --- a/pylint/testutils/_primer/primer_run_command.py +++ b/pylint/testutils/_primer/primer_run_command.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -77,7 +77,8 @@ class RunCommand(PrimerCommand): # Duplicate code takes too long and is relatively safe # TODO: Find a way to allow cyclic-import and compare output correctly disables = ["--disable=duplicate-code,cyclic-import"] - arguments = data.pylint_args + enables + disables + additional = ["--clear-cache-post-run=y"] + arguments = data.pylint_args + enables + disables + additional output = StringIO() reporter = JSONReporter(output) print(f"Running 'pylint {', '.join(arguments)}'") @@ -96,6 +97,7 @@ class RunCommand(PrimerCommand): if fatal_msgs: warnings.warn( f"Encountered fatal errors while priming {package_name} !\n" - f"{self._print_msgs(fatal_msgs)}\n\n" + f"{self._print_msgs(fatal_msgs)}\n\n", + stacklevel=2, ) return messages, fatal_msgs |