mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
remove python 2.x cross version tests
This commit is contained in:
parent
46c64efd9d
commit
0b45ecc8a4
3 changed files with 4 additions and 32 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue