diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9b908c6..836a062 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,39 +1,20 @@ -# We from the Oslo project decided to pin repos based on the -# commit hash instead of the version tag to prevend arbitrary -# code from running in developer's machines. To update to a -# newer version, run `pre-commit autoupdate` and then replace -# the newer versions with their commit hash. - -default_language_version: - python: python3 - repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 9136088a246768144165fcc3ecc3d31bb686920a # v3.3.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - # Replaces or checks mixed line ending - id: mixed-line-ending args: ['--fix', 'lf'] exclude: '.*\.(svg)$' - # Forbid files which have a UTF-8 byte-order marker - - id: check-byte-order-marker - # Checks that non-binary executables have a proper shebang + - id: fix-byte-order-marker - id: check-executables-have-shebangs - # Check for files that contain merge conflict strings. - id: check-merge-conflict - # Check for debugger imports and py37+ breakpoint() - # calls in python source - id: debug-statements - id: check-yaml files: .*\.(yaml|yml)$ - - repo: local + - repo: https://opendev.org/openstack/hacking + rev: 7.0.0 hooks: - - id: flake8 - name: flake8 - additional_dependencies: - - hacking>=6.1.0,<6.2.0 - language: python - entry: flake8 - files: '^.*\.py$' + - id: hacking + additional_dependencies: [] exclude: '^(doc|releasenotes|tools)/.*$' diff --git a/test-requirements.txt b/test-requirements.txt index bcefeb2..247ecd9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,4 @@ -hacking>=6.1.0,<6.2.0 # Apache-2.0 coverage>=3.6 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 testtools>=1.4.0 # MIT gabbi>=1.35.0 # Apache-2.0 -pre-commit>=2.6.0 # MIT diff --git a/tox.ini b/tox.ini index 0dec6f8..851eba9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,41 +1,46 @@ [tox] -minversion = 3.1.1 -skipsdist = True -# If you want pypy or pypy3, do 'tox -epypy,pypy3', it might work! -# And you can get coverage with 'tox -ecover'. +minversion = 4.3.0 envlist = py3,pep8 -ignore_basepython_conflict = True [testenv] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -install_command = pip install -U {opts} {packages} -usedevelop = True -commands = stestr run {posargs} +description = + Run unit tests. +deps = + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = + stestr run {posargs} [testenv:venv] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt commands = {posargs} [testenv:pep8] -usedevelop = False +description = + Run style checks. +skip_install = true +deps = + pre-commit commands = - pre-commit run -a + pre-commit run --all-files --show-diff-on-failure [testenv:cover] -setenv = PYTHON=coverage run --source microversion_parse --parallel-mode +description = + Run unit tests and generate coverage report. +setenv = + PYTHON=coverage run --source microversion_parse --parallel-mode commands = coverage erase - find . -type f -name "*.pyc" -delete stestr run {posargs} coverage combine coverage html -d cover -whitelist_externals = - find [testenv:docs] -deps = -r{toxinidir}/doc/requirements.txt +description = + Build documentation in HTML format. +deps = + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build sphinx-build -W --keep-going -b html -d doc/build/doctrees doc/source doc/build/html @@ -44,5 +49,5 @@ whitelist_externals = [flake8] ignore = H405,E126 -exclude=.venv,.git,.tox,dist,*egg,*.egg-info,build,examples,doc -show-source = True +exclude = .venv,.git,.tox,dist,*egg,*.egg-info,build,examples,doc +show-source = true