Skip to content

Commit 0b45ecc

Browse files
committed
remove python 2.x cross version tests
1 parent 46c64ef commit 0b45ecc

File tree

3 files changed

+4
-32
lines changed

3 files changed

+4
-32
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
- The complete test suite depends on having at least the following installed
66
(possibly not a complete list)
77
- git (Version 2.24.0 or above is required to run pre-merge-commit tests)
8-
- python2 (Required by a test which checks different python versions)
98
- python3 (Required by a test which checks different python versions)
109
- tox (or virtualenv)
1110
- ruby + gem

testing/resources/python3_hooks_repo/.pre-commit-hooks.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
name: Python 3 Hook
33
entry: python3-hook
44
language: python
5+
language_version: python3
56
files: \.py$

tests/repository_test.py

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -173,23 +173,6 @@ def test_python_venv(tempdir_factory, store):
173173
)
174174

175175

176-
@xfailif_windows # pragma: win32 no cover # no python 2 in GHA
177-
def test_switch_language_versions_doesnt_clobber(tempdir_factory, store):
178-
# We're using the python3 repo because it prints the python version
179-
path = make_repo(tempdir_factory, 'python3_hooks_repo')
180-
181-
def run_on_version(version, expected_output):
182-
config = make_config_from_repo(path)
183-
config['hooks'][0]['language_version'] = version
184-
hook = _get_hook(config, store, 'python3-hook')
185-
ret, out = _hook_run(hook, [], color=False)
186-
assert ret == 0
187-
assert _norm_out(out) == expected_output
188-
189-
run_on_version('python2', b'2\n[]\nHello World\n')
190-
run_on_version('python3', b'3\n[]\nHello World\n')
191-
192-
193176
def test_versioned_python_hook(tempdir_factory, store):
194177
_test_hook_repo(
195178
tempdir_factory, store, 'python3_hooks_repo',
@@ -883,7 +866,7 @@ def test_tags_on_repositories(in_tmpdir, tempdir_factory, store):
883866
@pytest.fixture
884867
def local_python_config():
885868
# Make a "local" hooks repo that just installs our other hooks repo
886-
repo_path = get_resource_path('python3_hooks_repo')
869+
repo_path = get_resource_path('python_hooks_repo')
887870
manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
888871
hooks = [
889872
dict(hook, additional_dependencies=[repo_path]) for hook in manifest
@@ -892,23 +875,12 @@ def local_python_config():
892875

893876

894877
def test_local_python_repo(store, local_python_config):
895-
hook = _get_hook(local_python_config, store, 'python3-hook')
896-
# language_version should have been adjusted to the interpreter version
897-
assert hook.language_version != C.DEFAULT
898-
ret, out = _hook_run(hook, ('filename',), color=False)
899-
assert ret == 0
900-
assert _norm_out(out) == b"3\n['filename']\nHello World\n"
901-
902-
903-
@xfailif_windows # pragma: win32 no cover # no python2 in GHA
904-
def test_local_python_repo_python2(store, local_python_config):
905-
local_python_config['hooks'][0]['language_version'] = 'python2'
906-
hook = _get_hook(local_python_config, store, 'python3-hook')
878+
hook = _get_hook(local_python_config, store, 'foo')
907879
# language_version should have been adjusted to the interpreter version
908880
assert hook.language_version != C.DEFAULT
909881
ret, out = _hook_run(hook, ('filename',), color=False)
910882
assert ret == 0
911-
assert _norm_out(out) == b"2\n['filename']\nHello World\n"
883+
assert _norm_out(out) == b"['filename']\nHello World\n"
912884

913885

914886
def test_default_language_version(store, local_python_config):

0 commit comments

Comments
 (0)