Agent skill

Python Test Updater

by ArabelaTso in ArabelaTso/Skills-4-SE

Updates Python test code to work with new versions of the code being tested.

Apache-2.0Auto-check passedTesting & QA

Install Python Test Updater

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill python-test-updater -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE python-test-updater --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/python-test-updater .claude/skills/python-test-updater && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
python-test-updater
GitHub stars
253
Token cost
~2.7k tokens
SKILL.md length
778 words
Files
3 (incl. scripts, references)
Skills in repo
151
Repo updated
First seen
Licence
Apache-2.0

At a glance

Updates Python test code to work with new versions of the code being tested.

  • Works in 8 steps: Understand the Inputs → Analyze Code Changes → Analyze Test Structure → …
  • Claude needs to:
  • SKILL.md covers Workflow, Common Update Patterns, Best Practices and Troubleshooting, plus 2 more sections
  • Runs Python scripts from its folder; calls pytest and python

What it does

Python Test Updater is an agent skill from ArabelaTso/Skills-4-SE. Updates Python test code to work with new versions of the code being tested. Use when Claude needs to: (1) Update tests after code changes, (2) Fix broken tests due to signature changes, (3) Update assertions to match new behavior, (4) Add test cases for new functionality, (5) Analyze code differences and their test impact, (6) Run tests and fix failures based on error messages. Takes old code, new code, and old tests as input, outputs updated tests that pass.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including scripts and reference files (for example `references/test-update-patterns.md` and `scripts/analyze_code_diff.py`).

It sits in Testing & QA, covering Test generation. It works with Python. The repository describes itself as: A curated list of 180+ useful Claude Skills for Software Engineering and resources for customizing AI for SE workflows. The licence is Apache-2.0.

When your agent uses it

  • Claude needs to:
  • Update tests after code changes
  • Fix broken tests due to signature changes
  • Update assertions to match new behavior

Example prompts

  • “Use the python-test-updater skill to update Python test code to work with new versions of the code being tested”
  • “/python-test-updater”

Requirements

  • Python 3

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Understand the Inputs
  2. Analyze Code Changes
  3. Analyze Test Structure
  4. Determine Required Updates
  5. Update Test Code
  6. Run Tests
  7. Fix Remaining Failures
  8. Verify and Refine

What it can do on your machine

Read from SKILL.md and the folder at commit 4f38503. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • pytest
    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Python Test Updater loads about 2.7k tokens when it runs, and up to ~5k if it reads all its reference files. Until then it costs about 121 tokens; SKILL.md has 778 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~121
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from ArabelaTso/Skills-4-SE at commit 4f38503, republished under its Apache-2.0 licence (© ArabelaTso). 778 words, ~2,696 tokens.

Download SKILL.mdSave it as .claude/skills/python-test-updater/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
python-test-updater
description
Updates Python test code to work with new versions of the code being tested. Use when Claude needs to: (1) Update tests after code changes, (2) Fix broken tests due to signature changes, (3) Update assertions to match new behavior, (4) Add test cases for new functionality, (5) Analyze code differences and their test impact, (6) Run tests and fix failures based on error messages. Takes old code, new code, and old tests as input, outputs updated tests that pass.

Python Test Updater

Update Python tests to work correctly with new code versions.

Workflow

1. Understand the Inputs

Gather required inputs:

  • Old version of Python code (file or content)
  • New version of Python code (file or content)
  • Old test module or test functions (file or content)

Verify inputs:

  • Code files are valid Python
  • Test files use pytest or unittest
  • Files are readable
2. Analyze Code Changes

Automated analysis:

bash
python scripts/analyze_code_diff.py <old_file> <new_file>

Manual analysis:

  • Read both old and new code versions
  • Identify what changed
  • Understand the nature of changes

Identify change types:

Function signature changes:

  • Added parameters
  • Removed parameters
  • Renamed parameters
  • Changed parameter types
  • Changed default values

Return value changes:

  • Changed return type
  • Changed return structure
  • Added return fields
  • Removed return fields

Behavior changes:

  • Modified logic
  • Changed validation rules
  • Updated error handling
  • Altered workflows

Class changes:

  • Added/removed methods
  • Modified constructor
  • Changed inheritance
  • Updated attributes

Async changes:

  • Sync to async conversion
  • Async to sync conversion

See test-update-patterns.md for detailed patterns.

3. Analyze Test Structure

Read the old tests:

  • Identify test functions
  • Understand test setup (fixtures, mocks)
  • Note test assertions
  • Check test organization

Identify test components:

  • Test functions/methods
  • Fixtures
  • Parametrized tests
  • Mocked dependencies
  • Assertions

Map tests to code:

  • Which tests cover which functions/classes
  • What behavior each test verifies
  • What assertions check what conditions
4. Determine Required Updates

For each code change, identify test impact:

Signature changes → Update function calls

python
# Old code: function(arg1, arg2)
# New code: function(arg1, arg2, arg3=default)

# Old test
result = function(value1, value2)

# Updated test
result = function(value1, value2)  # Works with default
# OR
result = function(value1, value2, value3)  # Explicit value

Return value changes → Update assertions

python
# Old code: return value
# New code: return {"result": value, "status": "ok"}

# Old test
assert result == expected_value

# Updated test
assert result["result"] == expected_value
assert result["status"] == "ok"

Behavior changes → Update expected values

python
# Old code: validates length >= 6
# New code: validates length >= 8 and has digit

# Old test
assert validate("abc123") == True

# Updated test
assert validate("abc12345") == True  # Updated
assert validate("abc123") == False   # Now fails

New functionality → Add new tests

python
# New code: added get_display_name() method

# Add new test
def test_get_display_name():
    obj = MyClass("value")
    assert obj.get_display_name() == "Value: value"
5. Update Test Code

Apply updates systematically:

Step 1: Update imports if needed

python
# If new exceptions or classes added
from module import NewException, NewClass

Step 2: Update function/method calls

  • Add new required parameters
  • Remove obsolete parameters
  • Rename parameters if changed
  • Update keyword arguments

Step 3: Update assertions

  • Change expected values if behavior changed
  • Update assertion structure if return type changed
  • Add new assertions for new fields
  • Remove assertions for removed fields

Step 4: Update exception handling

python
# Old
with pytest.raises(OldException):
    function()

# New
with pytest.raises(NewException):
    function()

Step 5: Update async/await if needed

python
# Old
def test_function():
    result = function()

# New (if function became async)
@pytest.mark.asyncio
async def test_function():
    result = await function()

Step 6: Add new test cases

  • Test new functionality
  • Test new parameters
  • Test new behavior
  • Test edge cases
6. Run Tests

Execute the updated tests:

bash
# Run all tests
pytest test_file.py

# Run specific test
pytest test_file.py::test_function

# Run with verbose output
pytest -v test_file.py

Check results:

  • All tests should pass
  • No import errors
  • No syntax errors
  • No assertion failures
7. Fix Remaining Failures

If tests still fail:

Analyze error messages:

  • Read the error carefully
  • Identify what's failing
  • Understand why it's failing

Common failure types:

1. AssertionError

AssertionError: assert 10 == 15

→ Expected value changed, update assertion

2. TypeError

TypeError: function() missing 1 required positional argument: 'new_param'

→ Add missing parameter to function call

3. AttributeError

AttributeError: 'dict' object has no attribute 'field'

→ Return type changed, update how result is accessed

4. ImportError

ImportError: cannot import name 'OldClass'

→ Class renamed or removed, update import

Fix each failure:

  1. Identify the root cause
  2. Apply appropriate fix
  3. Re-run tests
  4. Verify fix works
8. Verify and Refine

Final verification:

  • All tests pass
  • Test coverage maintained
  • Test intent preserved
  • Code quality good

Refine if needed:

  • Improve test names
  • Add docstrings
  • Use fixtures for common setup
  • Parametrize similar tests

Example refinement:

python
# Before
def test_function_case1():
    assert function(5) == 10

def test_function_case2():
    assert function(10) == 20

# After (parametrized)
@pytest.mark.parametrize("input,expected", [
    (5, 10),
    (10, 20),
])
def test_function(input, expected):
    assert function(input) == expected

Common Update Patterns

Show full SKILL.md (313 more words)Show less
Pattern 1: Add Parameter with Default

Code change:

python
# Old
def function(a, b):
    return a + b

# New
def function(a, b, c=0):
    return a + b + c

Test update:

python
# Old test (still works)
def test_function():
    assert function(1, 2) == 3

# Add new test for new parameter
def test_function_with_c():
    assert function(1, 2, 3) == 6
Pattern 2: Change Return Type

Code change:

python
# Old
def get_data():
    return [1, 2, 3]

# New
def get_data():
    return {"data": [1, 2, 3], "count": 3}

Test update:

python
# Old
def test_get_data():
    data = get_data()
    assert len(data) == 3

# New
def test_get_data():
    result = get_data()
    assert len(result["data"]) == 3
    assert result["count"] == 3
Pattern 3: Change Validation Logic

Code change:

python
# Old
def validate(value):
    return len(value) >= 6

# New
def validate(value):
    return len(value) >= 8 and any(c.isdigit() for c in value)

Test update:

python
# Old
def test_validate():
    assert validate("abc123") == True
    assert validate("abc") == False

# New
def test_validate():
    assert validate("abc12345") == True  # Updated
    assert validate("abc123") == False   # Now fails validation
    assert validate("abcdefgh") == False # No digit
    assert validate("abc") == False
Pattern 4: Sync to Async

Code change:

python
# Old
def fetch():
    return data

# New
async def fetch():
    return await async_data()

Test update:

python
# Old
def test_fetch():
    result = fetch()
    assert result is not None

# New
@pytest.mark.asyncio
async def test_fetch():
    result = await fetch()
    assert result is not None

Best Practices

Preserve Test Intent
  • Keep testing the same functionality
  • Don't change what's being verified
  • Only update how it's tested
Maintain Coverage
  • Don't remove tests unless functionality removed
  • Add tests for new functionality
  • Keep edge case tests
Update Systematically
  • Fix one type of issue at a time
  • Run tests after each change
  • Verify fixes don't break other tests
Improve While Updating
  • Use fixtures for common setup
  • Parametrize similar tests
  • Improve test names and docs
Verify Thoroughly
  • Run full test suite
  • Check for flaky tests
  • Verify test independence

Troubleshooting

Issue: Tests pass but don't test new behavior

Solution:

  • Add new test cases for new functionality
  • Update existing tests to cover new parameters
  • Verify test coverage
Issue: Can't determine what changed

Solution:

  • Use code diff analyzer script
  • Compare function signatures manually
  • Run old tests against new code to see failures
  • Analyze error messages
Issue: Too many test failures

Solution:

  • Fix one test at a time
  • Group similar failures
  • Fix systematic issues first (imports, signatures)
  • Then fix assertion issues
Issue: Tests pass but behavior seems wrong

Solution:

  • Verify test assertions are correct
  • Check if test is actually testing new behavior
  • Add more specific assertions
  • Test edge cases

Example Workflow

Scenario: Function signature changed

Old code:

python
def calculate_price(quantity, unit_price):
    return quantity * unit_price

New code:

python
def calculate_price(quantity, unit_price, discount=0.0):
    subtotal = quantity * unit_price
    return subtotal * (1 - discount)

Old test:

python
def test_calculate_price():
    price = calculate_price(5, 10.0)
    assert price == 50.0

Analysis:

  • Added parameter: discount with default value 0.0
  • Behavior unchanged when discount not provided
  • New behavior when discount provided

Updated test:

python
def test_calculate_price():
    # Test without discount (original behavior)
    price = calculate_price(5, 10.0)
    assert price == 50.0

def test_calculate_price_with_discount():
    # Test with discount (new behavior)
    price = calculate_price(5, 10.0, 0.1)
    assert price == 45.0  # 50 * 0.9

Verification:

bash
pytest test_file.py -v
# Both tests should pass

Output Format

Provide updated test code with:

  1. Summary of changes:

    • What was updated
    • Why it was updated
    • New tests added
  2. Updated test code:

    • Complete updated test file
    • All necessary imports
    • All test functions
  3. Verification notes:

    • How to run tests
    • Expected results
    • Any caveats or notes

© ArabelaTso, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts, references) in skills/python-test-updater of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/test-update-patterns.md
  • scripts/analyze_code_diff.py

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Python Test Updater next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python Test Updater compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python Test Updater this skillArabelaTso/Skills-4-SE253—~2.7kAutomated safety check: PassApache-2.0
Adk Verify Snippetsgoogle/adk-python22k—~1.4kAutomated safety check: PassApache-2.0
Hermetic Python Unit TestsdimensionalOS/dimos4.6k—~1.4kAutomated safety check: PassCustom licence
Find Untested Sourcesdotnet/skills5.6k1 repos~3.3kAutomated safety check: PassMIT
Test Coverage Reviewareed1192/finance-news-aggregator149—~2.6kAutomated safety check: PassMIT
Crap Analyzerswingerman/engineer154—~1.2kAutomated safety check: PassMIT

Similar skills

  • Adk Verify Snippets

    google/adk-python

    Official

    Checks that every Python code block in a Markdown file actually compiles and runs, by extracting each block to a temporary file, executing it in an isolated subprocess, and writing a pass/fail…

    22k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Hermetic Python Unit Tests

    dimensionalOS/dimos

    Rules for writing, fixing and reviewing pytest unit tests that are hermetic: behavior-focused, deterministic, isolated and cheap to run.

    4.6k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Official

    Statically pairs source files with test files to list code that no test references, using Roslyn for C# or tree-sitter for many languages, with no build.

    5.6k GitHub starsUsed in 1 repo~3.3k tokens
    Testing & QAAuto-check passed
  • Test Coverage Review

    areed1192/finance-news-aggregator

    Audit, plan, write, and verify unit tests for Python projects using pytest.

    149 GitHub stars~2.6k tokensUpdated 5 mo ago
    Testing & QAAuto-check passed
  • Crap Analyzer

    swingerman/engineer

    A skill your agent uses to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods.

    154 GitHub stars~1.2k tokensUpdated 14 days ago
    Testing & QAAuto-check passed
  • Test Design

    jjjkkkjjj/Matft

    Procedure for designing and writing Matft's XCTest cases with high coverage — boundary values, dtypes, memory layouts, NaN/inf, empty arrays, broadcasting, platform differences, performance and…

    147 GitHub stars~2k tokensUpdated 10 days ago
    Testing & QAAuto-check passed

More from ArabelaTso/Skills-4-SE

All 151 skills in this repo
  • Framework Migration Assistant

    ArabelaTso/Skills-4-SE

    Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).

    253 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Metamorphic Test Generator

    ArabelaTso/Skills-4-SE

    Generate test cases using metamorphic testing by applying transformations based on metamorphic properties.

    253 GitHub stars~798 tokensUpdated 1 mo ago
    Auto-check passed
  • Reproduction Trace Instrumenter

    ArabelaTso/Skills-4-SE

    Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures.

    253 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Spring Mvc To Boot Migrator

    ArabelaTso/Skills-4-SE

    Automatically migrate Spring MVC applications to Spring Boot.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • State Snapshot Instrumenter

    ArabelaTso/Skills-4-SE

    Instrument programs (Python, C/C++, Java) to capture snapshots of key program states at runtime, including variables, memory, and call stacks.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Python Test Updater

What does Python Test Updater do?

Updates Python test code to work with new versions of the code being tested. Python Test Updater is an agent skill from ArabelaTso/Skills-4-SE. Updates Python test code to work with new versions of the code being tested.

When should I use Python Test Updater?

Python Test Updater fits situations like: Claude needs to:; update tests after code changes; fix broken tests due to signature changes; update assertions to match new behavior.

How do I install Python Test Updater in Claude Code?

Run `npx skills add ArabelaTso/Skills-4-SE --skill python-test-updater -a claude-code`. Or copy the skill folder (skills/python-test-updater in ArabelaTso/Skills-4-SE) into .claude/skills/python-test-updater in your project. Claude Code loads it when a task matches its description.

How do I install Python Test Updater in Codex?

Run `npx skills add ArabelaTso/Skills-4-SE --skill python-test-updater -a codex`. Or copy the skill folder (skills/python-test-updater in ArabelaTso/Skills-4-SE) into .agents/skills/python-test-updater in your project. Codex loads it when a task matches its description.

Can I use Python Test Updater in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArabelaTso/Skills-4-SE --skill python-test-updater -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/python-test-updater, .gemini/skills/python-test-updater, .github/skills/python-test-updater and .opencode/skills/python-test-updater in your project.

What does Python Test Updater need to run?

Going by SKILL.md and its folder, Python Test Updater needs Python for the scripts in its folder and the command-line tools its instructions call (pytest and python). Our summary lists: Python 3.

Does Python Test Updater access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Python Test Updater safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Python Test Updater use?

Python Test Updater is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python Test Updater use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.3k tokens, read only when the agent opens those files.

What are the alternatives to Python Test Updater?

Skills that share tags, products or a category with Python Test Updater: Adk Verify Snippets (google/adk-python, 22k stars), Hermetic Python Unit Tests (dimensionalOS/dimos, 4.6k stars), Find Untested Sources (dotnet/skills, 5.6k stars) and Test Coverage Review (areed1192/finance-news-aggregator, 149 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python Test Updater?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 151 skills in this directory. The repository was last updated on August 21, 2026.

Source: ArabelaTso/Skills-4-SE on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.