mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Use our VERSION constant moar
This commit is contained in:
parent
c1ca3aeaf7
commit
63d6bed423
2 changed files with 4 additions and 12 deletions
|
|
@ -7,9 +7,9 @@ import re
|
||||||
|
|
||||||
import jsonschema
|
import jsonschema
|
||||||
import jsonschema.exceptions
|
import jsonschema.exceptions
|
||||||
import pkg_resources
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
import pre_commit.constants as C
|
||||||
from pre_commit import output
|
from pre_commit import output
|
||||||
from pre_commit.jsonschema_extensions import apply_defaults
|
from pre_commit.jsonschema_extensions import apply_defaults
|
||||||
|
|
||||||
|
|
@ -72,11 +72,7 @@ def get_run_function(filenames_help, validate_strategy, exception_cls):
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('filenames', nargs='*', help=filenames_help)
|
parser.add_argument('filenames', nargs='*', help=filenames_help)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-V', '--version',
|
'-V', '--version', action='version', version=C.VERSION,
|
||||||
action='version',
|
|
||||||
version='%(prog)s {}'.format(
|
|
||||||
pkg_resources.get_distribution('pre-commit').version
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,9 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import pkg_resources
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pre_commit import constants as C
|
import pre_commit.constants as C
|
||||||
from pre_commit import five
|
from pre_commit import five
|
||||||
from pre_commit import parse_shebang
|
from pre_commit import parse_shebang
|
||||||
from pre_commit.clientlib.validate_manifest import load_manifest
|
from pre_commit.clientlib.validate_manifest import load_manifest
|
||||||
|
|
@ -721,10 +720,7 @@ def test_too_new_version(tempdir_factory, store, fake_log_handler):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize('version', ('0.1.0', C.VERSION))
|
||||||
'version',
|
|
||||||
('0.1.0', pkg_resources.get_distribution('pre-commit').version),
|
|
||||||
)
|
|
||||||
def test_versions_ok(tempdir_factory, store, version):
|
def test_versions_ok(tempdir_factory, store, version):
|
||||||
path = make_repo(tempdir_factory, 'script_hooks_repo')
|
path = make_repo(tempdir_factory, 'script_hooks_repo')
|
||||||
with modify_manifest(path) as manifest:
|
with modify_manifest(path) as manifest:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue