{"id":10230,"library":"skippy-cov","title":"Skippy-Cov","description":"Skippy-cov is a pytest plugin that intelligently selects and runs only relevant tests based on the current Git diff and previously collected coverage data. It aims to speed up CI/CD pipelines by avoiding unnecessary test runs by analyzing which code changes affect which tests. The current version is 0.2.2, with releases occurring periodically to refine its Git and pytest integration.","status":"active","version":"0.2.2","language":"en","source_language":"en","source_url":"https://github.com/shiphero/skippy-cov","tags":["pytest","coverage","testing","git","ci-cd"],"install":[{"cmd":"pip install skippy-cov","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core test runner integration for the plugin","package":"pytest","optional":false},{"reason":"Coverage data collection and analysis","package":"coverage","optional":false},{"reason":"Pythonic interface to Git repositories","package":"GitPython","optional":false}],"imports":[],"quickstart":{"code":"mkdir my_skippy_project && cd my_skippy_project\ngit init -b main\npip install skippy-cov pytest coverage\n\n# Create a simple module and test file\nmkdir src && mkdir src/tests\necho \"def func_a():\\n    return 'A'\\ndef func_b():\\n    return 'B'\" > src/my_module.py\necho \"import pytest\\nfrom src.my_module import func_a, func_b\\n\\ndef test_func_a():\\n    assert func_a() == 'A'\\n\\ndef test_func_b():\\n    assert func_b() == 'B'\" > src/tests/test_my_module.py\ntouch src/__init__.py src/tests/__init__.py\ngit add .\ngit commit -m \"Initial code and tests\"\n\necho \"\\n--- First run: Collect all coverage data ---\"\npytest --skippy-cov --cov=src --cov-report=xml src/tests/\n\n# Simulate a change to func_a and add a new test on a feature branch\ngit checkout -b feature/new-func\necho \"def func_a():\\n    return 'A_modified'\\ndef func_b():\\n    return 'B'\\ndef func_c():\\n    return 'C'\" > src/my_module.py\necho \"import pytest\\nfrom src.my_module import func_a, func_b, func_c\\n\\ndef test_func_a():\\n    assert func_a() == 'A_modified'\\n\\ndef test_func_func_b():\\n    assert func_b() == 'B'\\n\\ndef test_func_c():\\n    assert func_c() == 'C'\" > src/tests/test_my_module.py\ngit add .\ngit commit -m \"Add func_c and modify func_a\"\n\necho \"\\n--- Second run: Run only affected tests using diff ---\"\n# Generate a diff between 'main' branch and current 'feature/new-func' branch\ngit diff main...feature/new-func -- src/my_module.py > /tmp/my_skippy_diff.diff\npytest --skippy-cov=/tmp/my_skippy_diff.diff src/tests/\necho \"Expected: Only tests related to func_a (modified) and func_c (new) should run.\"\n","lang":"bash","description":"This quickstart demonstrates how to install skippy-cov, set up a minimal Git repository with a module and tests, run `pytest` to collect initial coverage data, then simulate code changes on a feature branch, and finally use `skippy-cov` with a Git diff to run only the affected tests."},"warnings":[{"fix":"Ensure you run `git init` in your project root before using skippy-cov, and make sure your changes are committed or staged for diffing.","message":"Skippy-cov requires the project to be a properly initialized Git repository. It relies heavily on Git commands for diffing and file tracking.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install all necessary packages: `pip install skippy-cov pytest coverage`.","message":"Skippy-cov is a pytest plugin and depends on `pytest` and `coverage.py` being installed in the same environment. Without them, it cannot function correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your custom pytest plugins for compatibility. Most standard usage should be unaffected, but complex collection modifications might need adjustment.","message":"In version 0.2.0, skippy-cov changed its pytest integration strategy from `pytest_collection_modifyitems` to `pytest_configure`. This might affect users with highly customized pytest plugins that interact with collection hooks.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Generate the diff into a temporary file first: `git diff main...HEAD -- path/to/file.py > /tmp/my_diff.diff`, then pass the path to the `--skippy-cov` flag: `pytest --skippy-cov=/tmp/my_diff.diff`.","message":"When using `--skippy-cov` with a diff, it expects a path to a file containing the `git diff` output, not the diff output itself directly or a branch name.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Run `pip install skippy-cov`.","cause":"The skippy-cov package is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'skippy_cov'"},{"fix":"Ensure `skippy-cov` and `pytest` are installed and up-to-date: `pip install --upgrade skippy-cov pytest`. Verify `pytest --version` shows skippy-cov as a plugin.","cause":"The `skippy-cov` plugin is not being detected by `pytest`. This can happen if it's not installed, there's a version mismatch, or another plugin is interfering.","error":"pytest: error: unrecognized arguments: --skippy-cov"},{"fix":"Initialize a Git repository by running `git init` in your project's root directory or navigate to an existing Git repository.","cause":"Skippy-cov was executed in a directory that is not part of a Git repository. It requires Git for its core functionality.","error":"Fatal: not a git repository (or any of the parent directories): .git"},{"fix":"Install Git on your system and ensure it's accessible from your command line. For Linux: `sudo apt-get install git`, for macOS: `brew install git`, for Windows: download from git-scm.com.","cause":"The Git executable is not found in your system's PATH. Skippy-cov directly invokes Git commands.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'git'"}]}