Skip to main content

A pytest plugin to checks dead code with vulture

Project description

Run vulture ( with pytest to find dead code.

Sample Usage

py.test --vulture

would be the most simple usage and would run vulture for all error messages.

py.test --vulture --vulture-cfg-file=/test/vulture.ini

This would use the vulture with the /test/vulture.ini config path

Ignoring vulture messages in source code

  • ignoring lines :

def test():
    a = 2    # vulture: ignore
  • ignoring methods :

def test():  # vulture: ignore
  • ignoring classes :

class Test:  # vulture: ignore

Config file

The config file (the path can be defined by the –vulture-cfg-file option) can look like this

# completely exclude files for vulture
exclude =
    */test/* # We usualy exclude tests because tests can cover dead code

# those file are ignored by pytest, but still computed by vulture
ignore =

# ignoring names in code
ignore-names =

# ignoring decorators
ignore-decorators =

# ignore vulture type of messages
ignore-types =


This code depends on vulture


If you want to help development, there is overview documentation in DEVELOPMENT.rst.


If you encounter any problems, please file an issue along with a detailed description.



  • Uses vulture with pytest (tested with python 3.7 3.8 and 3.9, with vulture==2.3 and pytest 7.x)


  • stable Gatewatcher internal use only


  • unstable Gatewatcher internal use only

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-vulture-2.1.1.tar.gz (10.7 kB view hashes)

Uploaded source

Built Distribution

pytest_vulture-2.1.1-py3-none-any.whl (12.9 kB view hashes)

Uploaded py3

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