{"library":"pytest-describe","title":"pytest-describe","description":"pytest-describe is a plugin for the pytest testing framework that enables writing tests in an RSpec/Jasmine-style format, using arbitrary nested `describe-blocks`. This approach helps organize tests by context and behavior, making test suites more readable and maintainable. The current version is 3.1.0, and it is actively maintained with regular updates to support newer Python and pytest versions.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pytest-describe"],"cli":{"name":"pytest","version":"pytest 9.0.3"}},"imports":["from pytest_describe import behaves_like","def describe_feature():\n    def it_should_do_something():\n        pass"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\n\nclass Wallet:\n    def __init__(self, initial_amount=0):\n        self.balance = initial_amount\n\n    def spend_cash(self, amount):\n        if self.balance < amount:\n            raise ValueError(f'Not enough available to spend {amount}')\n        self.balance -= amount\n\n    def add_cash(self, amount):\n        self.balance += amount\n\ndef describe_wallet():\n    def describe_start_empty():\n        @pytest.fixture\n        def wallet():\n            return Wallet()\n\n        def initial_amount_is_zero(wallet):\n            assert wallet.balance == 0\n\n        def can_add_cash(wallet):\n            wallet.add_cash(80)\n            assert wallet.balance == 80\n\n        def cannot_spend_if_empty(wallet):\n            with pytest.raises(ValueError):\n                wallet.spend_cash(10)\n\n    def describe_with_starting_balance():\n        @pytest.fixture\n        def wallet():\n            return Wallet(20)\n\n        def initial_amount_is_twenty(wallet):\n            assert wallet.balance == 20\n\n        def describe_adding():\n            def add_little_cash(wallet):\n                wallet.add_cash(5)\n                assert wallet.balance == 25\n\n            def add_much_cash(wallet):\n                wallet.add_cash(980)\n                assert wallet.balance == 1000\n\n        def describe_spending():\n            def spend_cash(wallet):\n                wallet.spend_cash(15)\n                assert wallet.balance == 5\n\n            def spend_too_much_cash(wallet):\n                with pytest.raises(ValueError):\n                    wallet.spend_cash(25)","lang":"python","description":"This example demonstrates how to structure tests for a `Wallet` class using nested `describe_` blocks and `pytest` fixtures. Define a top-level `describe_` function, and then nest further `describe_` functions or test functions (which can also use the `it_` prefix) within them. Fixtures defined within a `describe_` block apply to all tests within that block and its nested blocks. Save this as a Python file (e.g., `test_wallet.py`) and run `pytest` from your terminal.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"3.1.0","pypi_latest":"3.1.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.7,"avg_import_s":0.11,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.1,"mem_mb":3.6,"disk_size":"30.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.8,"import_time_s":0.07,"mem_mb":3.7,"disk_size":"31M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.12,"mem_mb":4.2,"disk_size":"33.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.6,"import_time_s":0.1,"mem_mb":4.3,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.13,"mem_mb":4.8,"disk_size":"25.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.4,"import_time_s":0.14,"mem_mb":4.8,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.12,"mem_mb":4.8,"disk_size":"25.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.4,"import_time_s":0.13,"mem_mb":4.8,"disk_size":"25M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.08,"mem_mb":3.6,"disk_size":"30.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-describe","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.1,"import_time_s":0.07,"mem_mb":3.6,"disk_size":"31M"}]}}