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 (see the docs of kgb for details) , so it may break in future versions of 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.1.0 - 2021-03-01

  • Replace accessing private state of flake8 plugins with wrapping/spying on function, using kgb

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.1.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

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