Package: pytest-yapf3
pytest-yapf3Validate your Python file format with yapf.This is apytestplugin,
which make sure your python file is exactly formatted by yapf,
or it will crash when runningpytest.Installpipinstallpytest-yapf3Requires:Python 3.6 or abovePytest:pytest>=5.4,<8whenpytest-yapf3<0.7pytest>=7whenpytest-yapf3>=0.7If someone use this with Python 3.5 or Pytest less than 5.4, set'pytest-yapf3<0.6.0'.UsageModifysetup.cfg(orpytest.ini):[tool:pytest]addopts=--yapf--yapfdiffyapf-ignore=setup.pysrc/package/auto_generated/**.pyAdd--yapftopytestconfigurationaddopts.
If run withpytest -m yapf, onlyyapfis checked.By default, only line summaries is displayed.
With an optional--yapfdiff, a full text ofyapf -dis displayed.
If not configured here,pytest --yapfdiffwill also work.An optionalyapf-ignoreis supported.
Each line specifies a glob pattern of files which should not checkyapf.Thepytestwill cache success results of pytest-yapf3, and will not check again if files not changed.
Sometimes you may want to disable it.
There are 2 ways:pytest -p no:cacheproviderThis may crash if any other pytest plugin not supports.rm -rf .pytest_cache/v/yapfThis is ugly, but safe for any environment.Features and TodosBasic support to validateyapf.Fix the diff line count error and improve the performance.DisplayYAPF-checkas the error session name.DisplayYAPFinpytest --verbose.Addyapfas a marker to enablepytest -m yapf.Supportyapf-ignoreto ignore specified files.Skip running if a file is not changed.100% test coverage.DevelopPrepare the environment:pipenvinstall--dev
pipenvshellRun test:pytestBadgeLikeblack, if your project always pass yapf checking provided by this project,
you can use an unofficial badge to show off.Markdown (README.md)[![Code style: yapf](https://img.shields.io/badge/code%20style-yapf-blue)](https://github.com/google/yapf)reStructuredText (README.rst)..image::https://img.shields.io/badge/code%20style-yapf-blue:target:https://github.com/google/yapf:alt:Code style: yapfLicenseThe MIT License (MIT)Copyright (c) 2019~2022 Yan QiDongThis repository is forked frompytest-yapfin 2019, which isnot maintainedsince 2017.
Besides extra features, the project structure is adjusted,
and the code is enhanced to pass linters like flake8, pylint and, of course, yapf.The3inpytest-yapf3means this package supports Python 3 only.Change LogRelease 0.7.0Set pytest limit to>=7.Fix a pytest warning withfrom_parent.Release 0.6.2Set pytest limit to>=5.4,<8.Upgrade dependencies in Pipfile and its lock.Enable GitHub actions.Delete.travis.ymland.appveyor.ymlRelease 0.6.1Fix cache missing.Release 0.6.0Upgrade pytest to 5.4+, fix a warning.Support python 3.6+ only, abandon 3.5Use Pipfile withpipenvRelease 0.5.1Fix coverage missing lines.100% test coverage.Fix a crash when yapf crash.Change development status to stable.Release 0.5.0Skip running if a file is not changed.Add more usage description in README.Release 0.4.0Addyapfas a pytest marker to enablepytest -m yapfSupportyapf-ignoreto ignore specified filesFix a probabilistic issue caused by\rRelease 0.3.0DisplayYAPF-checkas the error session nameDisplay::YAPFinpytest --verboseRelease 0.2.0Since forked frompytest-yapf0.1.1, there are some improvements:Restructure the project and rewrite documentsSupport Python 3.4+ onlyAdd linters to pytest, and fix their errorsFix the line count errorChange build configurations inTravisandAppVeyorSupport coverage and displayed incodecov