mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 21:10:27 -06:00
remove python 2.x cross version tests
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
- The complete test suite depends on having at least the following installed
|
||||
(possibly not a complete list)
|
||||
- git (Version 2.24.0 or above is required to run pre-merge-commit tests)
|
||||
- python2 (Required by a test which checks different python versions)
|
||||
- python3 (Required by a test which checks different python versions)
|
||||
- tox (or virtualenv)
|
||||
- ruby + gem
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
name: Python 3 Hook
|
||||
entry: python3-hook
|
||||
language: python
|
||||
language_version: python3
|
||||
files: \.py$
|
||||
|
||||
@@ -173,23 +173,6 @@ def test_python_venv(tempdir_factory, store):
|
||||
)
|
||||
|
||||
|
||||
@xfailif_windows # pragma: win32 no cover # no python 2 in GHA
|
||||
def test_switch_language_versions_doesnt_clobber(tempdir_factory, store):
|
||||
# We're using the python3 repo because it prints the python version
|
||||
path = make_repo(tempdir_factory, 'python3_hooks_repo')
|
||||
|
||||
def run_on_version(version, expected_output):
|
||||
config = make_config_from_repo(path)
|
||||
config['hooks'][0]['language_version'] = version
|
||||
hook = _get_hook(config, store, 'python3-hook')
|
||||
ret, out = _hook_run(hook, [], color=False)
|
||||
assert ret == 0
|
||||
assert _norm_out(out) == expected_output
|
||||
|
||||
run_on_version('python2', b'2\n[]\nHello World\n')
|
||||
run_on_version('python3', b'3\n[]\nHello World\n')
|
||||
|
||||
|
||||
def test_versioned_python_hook(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
tempdir_factory, store, 'python3_hooks_repo',
|
||||
@@ -883,7 +866,7 @@ def test_tags_on_repositories(in_tmpdir, tempdir_factory, store):
|
||||
@pytest.fixture
|
||||
def local_python_config():
|
||||
# Make a "local" hooks repo that just installs our other hooks repo
|
||||
repo_path = get_resource_path('python3_hooks_repo')
|
||||
repo_path = get_resource_path('python_hooks_repo')
|
||||
manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
|
||||
hooks = [
|
||||
dict(hook, additional_dependencies=[repo_path]) for hook in manifest
|
||||
@@ -892,23 +875,12 @@ def local_python_config():
|
||||
|
||||
|
||||
def test_local_python_repo(store, local_python_config):
|
||||
hook = _get_hook(local_python_config, store, 'python3-hook')
|
||||
hook = _get_hook(local_python_config, store, 'foo')
|
||||
# language_version should have been adjusted to the interpreter version
|
||||
assert hook.language_version != C.DEFAULT
|
||||
ret, out = _hook_run(hook, ('filename',), color=False)
|
||||
assert ret == 0
|
||||
assert _norm_out(out) == b"3\n['filename']\nHello World\n"
|
||||
|
||||
|
||||
@xfailif_windows # pragma: win32 no cover # no python2 in GHA
|
||||
def test_local_python_repo_python2(store, local_python_config):
|
||||
local_python_config['hooks'][0]['language_version'] = 'python2'
|
||||
hook = _get_hook(local_python_config, store, 'python3-hook')
|
||||
# language_version should have been adjusted to the interpreter version
|
||||
assert hook.language_version != C.DEFAULT
|
||||
ret, out = _hook_run(hook, ('filename',), color=False)
|
||||
assert ret == 0
|
||||
assert _norm_out(out) == b"2\n['filename']\nHello World\n"
|
||||
assert _norm_out(out) == b"['filename']\nHello World\n"
|
||||
|
||||
|
||||
def test_default_language_version(store, local_python_config):
|
||||
|
||||
Reference in New Issue
Block a user