Skip to main content

Make pycodestyle treat pytest.importorskip as an import statement (avoid E402)

Project description

flake8-pytest-importorskip

pypi Python: 3.6+ Downloads Build Status Code coverage License: Apache 2.0 Code style: black

Description

Treat pytest.importorskip as an import statement, not code, to silence the "module level import not at top of file" (E402) from pycodestyle

It allows code such as this to pass without having to globally disable E402.

It does this in a slightly hacky way, so it may break in future versions of flake8 or pycodestyle.

Checks:

None

Installation

pip install flake8-pytest-importorskip

Usage

flake8 <your code>

For developers

Create venv and install deps

make init

Install git precommit hook

make precommit_install

Run linters, autoformat, tests etc.

make pretty lint test

Bump new version

make bump_major
make bump_minor
make bump_patch

License

Apache 2.0

Change Log

Unreleased

  • ...

1.0.0 - 2021-02-19

  • initial

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

flake8-pytest-importorskip-1.0.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file flake8-pytest-importorskip-1.0.0.tar.gz.

File metadata

  • Download URL: flake8-pytest-importorskip-1.0.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1039-azure

File hashes

Hashes for flake8-pytest-importorskip-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b284306f5bc9bc936063d633fb2f4cdff6c07a188d00354af8b2377077c0fbe0
MD5 1253c77826601a30e663d51933723822
BLAKE2b-256 9178dbca19263646f12ceae71c1d4e95cc865e4cc1923e7b4989054cd36126de

See more details on using hashes here.

File details

Details for the file flake8_pytest_importorskip-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_pytest_importorskip-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad3ecd089630fd3fd2222629316608194747347444e0043a57ff42b128c5ca0e
MD5 9060a30597c82934f11eb5c5c7b5cc11
BLAKE2b-256 76ea40aed152279c8696b2069fc94fca9139723783c541d8b34f8a2264a7d5d0

See more details on using hashes here.

Supported by

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