mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
drop python 3.6 support
python 3.6 reached end of life on 2021-12-23
This commit is contained in:
parent
d3bdf1403d
commit
04de6a2e57
111 changed files with 401 additions and 286 deletions
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from unittest import mock
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import shlex
|
||||
from unittest import mock
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
from unittest import mock
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
import pre_commit.constants as C
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from unittest import mock
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
from unittest import mock
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import re
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit.commands.migrate_config import migrate_config
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import shlex
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pre_commit.commands.sample_config import sample_config
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import re
|
||||
import time
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
import io
|
||||
import logging
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import stat
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
|
||||
import pytest
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit import envcontext
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import builtins
|
||||
import json
|
||||
import ntpath
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit.languages.golang import guess_go_dir
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import multiprocessing
|
||||
import os.path
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit.languages import pygrep
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import sys
|
||||
from unittest import mock
|
||||
|
|
@ -47,16 +49,16 @@ def test_norm_version_of_default_is_sys_executable():
|
|||
assert python.norm_version('default') is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('v', ('python3.6', 'python3', 'python'))
|
||||
@pytest.mark.parametrize('v', ('python3.9', 'python3', 'python'))
|
||||
def test_sys_executable_matches(v):
|
||||
with mock.patch.object(sys, 'version_info', (3, 6, 7)):
|
||||
with mock.patch.object(sys, 'version_info', (3, 9, 10)):
|
||||
assert python._sys_executable_matches(v)
|
||||
assert python.norm_version(v) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('v', ('notpython', 'python3.x'))
|
||||
def test_sys_executable_matches_does_not_match(v):
|
||||
with mock.patch.object(sys, 'version_info', (3, 6, 7)):
|
||||
with mock.patch.object(sys, 'version_info', (3, 9, 10)):
|
||||
assert not python._sys_executable_matches(v)
|
||||
|
||||
|
||||
|
|
@ -65,7 +67,7 @@ def test_sys_executable_matches_does_not_match(v):
|
|||
('/usr/bin/python3', '/usr/bin/python3.7', 'python3'),
|
||||
('/usr/bin/python', '/usr/bin/python3.7', 'python3.7'),
|
||||
('/usr/bin/python', '/usr/bin/python', None),
|
||||
('/usr/bin/python3.6m', '/usr/bin/python3.6m', 'python3.6m'),
|
||||
('/usr/bin/python3.7m', '/usr/bin/python3.7m', 'python3.7m'),
|
||||
('v/bin/python', 'v/bin/pypy', 'pypy'),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
|
||||
import pytest
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import tarfile
|
||||
from unittest import mock
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from pre_commit import color
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os.path
|
||||
from unittest import mock
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pre_commit.meta_hooks import check_hooks_apply
|
||||
from testing.fixtures import add_config_to_repo
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pre_commit import git
|
||||
from pre_commit.meta_hooks import check_useless_excludes
|
||||
from pre_commit.util import cmd_output
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pre_commit.meta_hooks import identity
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
|
||||
from pre_commit import output
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import os.path
|
||||
import shutil
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
|
||||
import pytest
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import shutil
|
||||
import sys
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from unittest import mock
|
||||
|
||||
import cfgv
|
||||
|
|
@ -897,7 +898,7 @@ def test_local_python_repo(store, local_python_config):
|
|||
|
||||
|
||||
def test_default_language_version(store, local_python_config):
|
||||
config: Dict[str, Any] = {
|
||||
config: dict[str, Any] = {
|
||||
'default_language_version': {'python': 'fake'},
|
||||
'default_stages': ['commit'],
|
||||
'repos': [local_python_config],
|
||||
|
|
@ -914,7 +915,7 @@ def test_default_language_version(store, local_python_config):
|
|||
|
||||
|
||||
def test_default_stages(store, local_python_config):
|
||||
config: Dict[str, Any] = {
|
||||
config: dict[str, Any] = {
|
||||
'default_language_version': {'python': C.DEFAULT},
|
||||
'default_stages': ['commit'],
|
||||
'repos': [local_python_config],
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
import os.path
|
||||
import shutil
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import sqlite3
|
||||
import stat
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os.path
|
||||
import stat
|
||||
import subprocess
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import concurrent.futures
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from typing import Tuple
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
|
@ -178,7 +179,7 @@ def test_thread_mapper_concurrency_uses_regular_map():
|
|||
|
||||
def test_xargs_propagate_kwargs_to_cmd():
|
||||
env = {'PRE_COMMIT_TEST_VAR': 'Pre commit is awesome'}
|
||||
cmd: Tuple[str, ...] = ('bash', '-c', 'echo $PRE_COMMIT_TEST_VAR', '--')
|
||||
cmd: tuple[str, ...] = ('bash', '-c', 'echo $PRE_COMMIT_TEST_VAR', '--')
|
||||
cmd = parse_shebang.normalize_cmd(cmd)
|
||||
|
||||
ret, stdout = xargs.xargs(cmd, ('1',), env=env)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue