pytest-pikachu
pytest-pikachu is a pytest plugin that displays a surprised Pikachu in the terminal when all tests pass successfully. It aims to add a touch of fun to the testing experience without affecting test logic. The current version is 1.0.0, and it is a stable, low-maintenance plugin that relies on pytest's plugin discovery mechanism.
Common errors
-
Pikachu is not showing up when my tests pass!
cause The plugin might not be correctly installed, your terminal might lack proper support for the animation, or not all tests are actually passing.fixFirst, verify `pytest-pikachu` is installed (`pip install pytest-pikachu`). Ensure all your tests pass (run `pytest -v`). Check your terminal emulator for proper Unicode and ANSI escape code support, especially on older or non-standard terminals. -
ModuleNotFoundError: No module named 'pytest_pikachu'
cause `pytest-pikachu` is a pytest plugin, not a standard Python library designed for direct `import` statements in user code.fixYou should not attempt to `import pytest_pikachu` in your Python files. Install it using `pip install pytest-pikachu`, and `pytest` will automatically discover and load the plugin when you run your tests.
Warnings
- gotcha Pikachu only appears if *all* tests pass. If even one test fails, is skipped, or errors, the Pikachu animation will not be displayed.
- gotcha This plugin is purely visual and provides no programmatic hooks, configuration options, or command-line arguments to modify its behavior or appearance.
Install
-
pip install pytest-pikachu pytest
Imports
- N/A (plugin auto-discovered)
No direct import needed
Quickstart
import pytest
# test_example.py
def test_passing_example():
assert True
def test_another_passing_case():
assert 1 + 1 == 2
# To run this example after installing pytest and pytest-pikachu:
# 1. Save the above code as 'test_example.py'
# 2. Open your terminal in the same directory
# 3. Run: pytest test_example.py
# If all tests pass, a surprised Pikachu will appear in your terminal output.