Skip to main content

Validate your Python file format with yapf

Project description

pytest-yapf3

Travis AppVeyor codecov

Validate your Python file format with yapf.

This is a pytest plugin, which make sure your python file is exactly formatted by yapf, or it will crash when running pytest.

Install

pip install pytest-yapf3

Usage

Modify setup.cfg (or pytest.ini):

[tool:pytest]
addopts =
    --yapf
    --yapfdiff

Add --yapf to pytest configuration addopts. By default, only line summaries is displayed. With --yapfdiff, a full text of yapf -d is displayed.

Features and Todos

  • Basic support to validate yapf.
  • Fix the diff line count error and improve the performance.
  • Display yapf as the session name.
  • Display YAPF in pytest --verbose.
  • Support --yapf-ignore to ignore specified files.
  • Skip running if a file is not changed.

Develop

Prepare the environment:

source your/virtual/env
pip install -e .[dev]

Run test:

pytest

License

License

The MIT License (MIT)

Copyright (c) 2019 Yan QiDong

This repository is forked from pytest-yapf in 2019, which is not maintained since 2017. Besides extra features, the project structure is adjusted, and the code is enhanced to pass linters like flake8, pylint and, of course, yapf.

pytest-yapf3 Change Log

Release 0.2.0

Since forked from pytest-yapf 0.1.1, there are some improvements:

  • Restructure the project and rewrite documents
  • Support Python 3.4+ only
  • Add linters to pytest, and fix their errors
  • Fix the line count error
  • Change build configurations in Travis and AppVeyor
  • Support coverage and displayed in codecov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-yapf3-0.2.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

pytest_yapf3-0.2.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest-yapf3-0.2.0.tar.gz.

File metadata

  • Download URL: pytest-yapf3-0.2.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1

File hashes

Hashes for pytest-yapf3-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9f5e42a7c9247e80361a26fd5fd8dd25b0d1f9fbc07507dc58072e9b21e64917
MD5 21560293207f38150791576c6202492e
BLAKE2b-256 279078290d9c2a9fdd78dbb42172e088222645ee1b5669248f562780c3de87de

See more details on using hashes here.

File details

Details for the file pytest_yapf3-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_yapf3-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1

File hashes

Hashes for pytest_yapf3-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29ded785785a7fb66b0fcd73d5c862aca0d7699b67f2c13ec997e207a79806b0
MD5 c66dd353a585166fe61a94c8877f3975
BLAKE2b-256 70c4f7336b5756f1dee69874c6f40e75c446ad2642f4cb77167c49e811cf7688

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page