Skip to main content

A pytest-based tool to list test fixtures declared but not used in a test

Project description

loofah

CircleCI

A tool to list test fixtures declared but not used in a test:

image

This tool is actually a pytest plugin, and with some improved packaging could be installed, and then called via the py.test command line.


Features

  • Uses the pytest collection to get a list of tests and available fixtures
  • Parses the code for each function to determine whether fixture arguments are used or not in the test
  • Supports a list of "ignored" fixtures, since some fixtures are only used to create and tear down a particular context, and might not be used directly in the test code

Installation

You can install loofah via pip:

$ pip install loofah

Usage

Since loofah relies on pytest collecting and being able to execute the tests, it needs to be run from your normal development shell, and probably installed in the venv of your project.

So, from your normal development shell, run loofah as you would run your tests: (ie with any required environment variables or virtual environment enabled, etc)

$ loofah test/unit
...
test/unit/account_tests.py:10 in test_account_update_requires_login detected 1 unused fixture:
    user
test/unit/account_tests.py:28 in test_account_locks_after_three_attempts detected 2 unused fixtures:
    user
    monkeypatch

Why 'loofah' ?

Why name this project after a fruit with fibrous, spongy interior often used to clean hard-to-reach areas of the human body? That's a mystery indeed.

License

Distributed under the terms of the MIT_ license, "loofah" is free and open source software

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

loofah-0.2.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

loofah-0.2.0-py2-none-any.whl (3.8 kB view details)

Uploaded Python 2

File details

Details for the file loofah-0.2.0.tar.gz.

File metadata

  • Download URL: loofah-0.2.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for loofah-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8a3ab9346969c72ee0fa72ff3d9dfea423c9154beb8049f995b6c01928d88335
MD5 6b7126ab40e876322ab886c053af94a0
BLAKE2b-256 09e7f102acfcb80ecb5e5d6f36878aec9df5c99cc6b1e62ea1c64e4c84fe9ac6

See more details on using hashes here.

File details

Details for the file loofah-0.2.0-py2-none-any.whl.

File metadata

  • Download URL: loofah-0.2.0-py2-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for loofah-0.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 16c057cab6e49527388c26b54bcba0a136190b49c0230bc0cbf9963a92660981
MD5 5dbb373f330d970bd9d4046d91707c32
BLAKE2b-256 6887330004d87766abee4579e733bf5018d9ca87094e299d4cb952d27511b52c

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