Skip to main content

Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

https://img.shields.io/travis/adamchainz/pytest-super-check.svg https://img.shields.io/pypi/v/pytest-super-check.svg https://img.shields.io/badge/code%20style-black-000000.svg

Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc.

Features

This plugin checks all TestCase classes in your test suite to ensure that their setUp, tearDown, setUpClass, tearDownClass, and setUpTestData (Django extension) methods all call super(). You might care about this when you have extensions to these methods in your project specific base class that when skipped (by accidentally missing super()), cause subtle bugs.

About

I developed this feature in a closed source Nose plugin whilst working on the big Django project at YPlan. We had some custom enhancements and fixes on top of the Django test classes, but some TestCase classes didn’t call super() in e.g. setUp, which caused the tests to fail, or incorrectly pass, in rather subtle ways. This problem is exacerbated by Django’s setUp etc. doing magic around not requiring super() to be called. Our solution was to just ensure every TestCase always calls super() in those methods. This is a Pytest port of that plugin.

Installation

Install from pip with:

pip install pytest-super-check

Python 3.5 to 3.8 supported.

Usage

Pytest will automatically find and use the plugin. Test discovery will then blow up if any subclasses of unittest.TestCase are found that have setUp etc. methods that don’t call super().

You can disable the plugin by passing the options -p no:super_check to pytest.

History

2.1.0 (2019-12-19)

  • Update Python support to 3.5-3.8, as 3.4 has reached its end of life.

  • Converted setuptools metadata to configuration file. This meant removing the __version__ attribute from the package. If you want to inspect the installed version, use importlib.metadata.version("pytest-super-check") (docs / backport).

2.0.0 (2019-02-28)

  • Drop Python 2 support, only Python 3.4+ is supported now.

1.0.0 (2016-04-22)

  • First release on PyPI

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-super-check-2.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_super_check-2.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest-super-check-2.1.0.tar.gz.

File metadata

  • Download URL: pytest-super-check-2.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

File hashes

Hashes for pytest-super-check-2.1.0.tar.gz
Algorithm Hash digest
SHA256 31ddb82d4ebed12885067e47eec839df02cbe93ccdfa24a51ea3862ca5cf22cd
MD5 729635486f877997bca393a783788cc2
BLAKE2b-256 eee6b739a9f25de46afa9e1c0b288c9c2b5912c75aeb2aa8c3d7b5cbdf1280ca

See more details on using hashes here.

File details

Details for the file pytest_super_check-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_super_check-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

File hashes

Hashes for pytest_super_check-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac6e742a9f9aad1ffb6f2c1965b5dd5a98759edc009f33c0acbcc9d00180b322
MD5 4952e88cb2aada8d89c7d8f48a8f1873
BLAKE2b-256 5db1d79eb5f88e0ba167f44f20752be34e3c1a3829c2125e4de92741af41619f

See more details on using hashes here.

Supported by

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