pytest-super-check


Namepytest-super-check JSON
Version 2.6.1 PyPI version JSON
download
home_pagehttps://github.com/adamchainz/pytest-super-check
SummaryPytest plugin to check your TestCase classes call super in setUp, tearDown, etc.
upload_time2022-12-07 01:55:56
maintainer
docs_urlNone
authorAdam Johnson
requires_python>=3.7
licenseMIT
keywords pytest super unittest testcase
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==================
pytest-super-check
==================

.. image:: https://img.shields.io/github/workflow/status/adamchainz/pytest-super-check/CI/main?style=for-the-badge
   :target: https://github.com/adamchainz/pytest-super-check/actions?workflow=CI

.. image:: https://img.shields.io/pypi/v/pytest-super-check.svg?style=for-the-badge
   :target: https://pypi.org/project/pytest-super-check/

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge
   :target: https://github.com/psf/black

.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge
   :target: https://github.com/pre-commit/pre-commit
   :alt: pre-commit

Unmaintained (2022-12-07)
-------------------------

I stopped maintaining this package as it has never been popular.
I think it would be better to use a lint rule to enforce calling ``super()`` in test cases.

----

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 with:

.. code-block:: bash

    python -m pip install pytest-super-check

Python 3.7 to 3.11 supported.

----

**Testing a Django project?**
Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of ways to write faster, more accurate tests.

----

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``.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/adamchainz/pytest-super-check",
    "name": "pytest-super-check",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "pytest,super,unittest,testcase",
    "author": "Adam Johnson",
    "author_email": "me@adamj.eu",
    "download_url": "https://files.pythonhosted.org/packages/de/eb/89c141363d567b97851039063ee1b70f0ac4d97103aa7e044fb020279c94/pytest-super-check-2.6.1.tar.gz",
    "platform": null,
    "description": "==================\npytest-super-check\n==================\n\n.. image:: https://img.shields.io/github/workflow/status/adamchainz/pytest-super-check/CI/main?style=for-the-badge\n   :target: https://github.com/adamchainz/pytest-super-check/actions?workflow=CI\n\n.. image:: https://img.shields.io/pypi/v/pytest-super-check.svg?style=for-the-badge\n   :target: https://pypi.org/project/pytest-super-check/\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge\n   :target: https://github.com/psf/black\n\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge\n   :target: https://github.com/pre-commit/pre-commit\n   :alt: pre-commit\n\nUnmaintained (2022-12-07)\n-------------------------\n\nI stopped maintaining this package as it has never been popular.\nI think it would be better to use a lint rule to enforce calling ``super()`` in test cases.\n\n----\n\nPytest plugin to check your TestCase classes call super in setUp, tearDown,\netc.\n\nFeatures\n========\n\nThis plugin checks all ``TestCase`` classes in your test suite to ensure that\ntheir ``setUp``, ``tearDown``, ``setUpClass``, ``tearDownClass``, and\n``setUpTestData`` (Django extension) methods all call ``super()``. You might\ncare about this when you have extensions to these methods in your project\nspecific base class that when skipped (by accidentally missing ``super()``),\ncause subtle bugs.\n\nAbout\n=====\n\nI developed this feature in a closed source Nose plugin whilst working on the\nbig Django project at YPlan. We had some custom enhancements and fixes on top\nof the Django test classes, but some ``TestCase`` classes didn't call\n``super()`` in e.g. ``setUp``, which caused the tests to fail, or incorrectly\npass, in rather subtle ways. This problem is exacerbated by Django's ``setUp``\netc. doing magic around not requiring ``super()`` to be called. Our solution\nwas to just ensure every ``TestCase`` always calls ``super()`` in those\nmethods. This is a Pytest port of that plugin.\n\nInstallation\n============\n\nInstall with:\n\n.. code-block:: bash\n\n    python -m pip install pytest-super-check\n\nPython 3.7 to 3.11 supported.\n\n----\n\n**Testing a Django project?**\nCheck out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of ways to write faster, more accurate tests.\n\n----\n\nUsage\n=====\n\nPytest will automatically find and use the plugin. Test discovery will then\nblow up if any subclasses of ``unittest.TestCase`` are found that have\n``setUp`` etc. methods that don't call ``super()``.\n\nYou can disable the plugin by passing the options ``-p no:super_check`` to\n``pytest``.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc.",
    "version": "2.6.1",
    "split_keywords": [
        "pytest",
        "super",
        "unittest",
        "testcase"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "e0d0447da1a3c5745c1494b49cfbb061",
                "sha256": "3de007907a4da84732bdc5a19e01d50346105c98d89fd36184b743f5b48b77ca"
            },
            "downloads": -1,
            "filename": "pytest_super_check-2.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e0d0447da1a3c5745c1494b49cfbb061",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4876,
            "upload_time": "2022-12-07T01:55:54",
            "upload_time_iso_8601": "2022-12-07T01:55:54.592378Z",
            "url": "https://files.pythonhosted.org/packages/fc/9c/4472491d48e7bf4698dcc41480db36ed51fcdaf4af634f740f0781d42d69/pytest_super_check-2.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "f57f1f1a16ac9ef00e11b36fd45a2130",
                "sha256": "3e2704a79c11399c6f50457751d6eda973ba35f5e408451c59a8bfd529545d1f"
            },
            "downloads": -1,
            "filename": "pytest-super-check-2.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f57f1f1a16ac9ef00e11b36fd45a2130",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5415,
            "upload_time": "2022-12-07T01:55:56",
            "upload_time_iso_8601": "2022-12-07T01:55:56.198103Z",
            "url": "https://files.pythonhosted.org/packages/de/eb/89c141363d567b97851039063ee1b70f0ac4d97103aa7e044fb020279c94/pytest-super-check-2.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-07 01:55:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "adamchainz",
    "github_project": "pytest-super-check",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pytest-super-check"
}
        
Elapsed time: 0.06043s