Skip to content
Back to skills

140 Claude F32703df

ASecurity

pytest tests for oh-my-claude hooks.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 11, 2026
testingpythonbashnodenodejs

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 140-claude_f32703df --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 140 Claude F32703df?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 140 Claude F32703df
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-140-claude-f32703df/badge)](https://www.skillsdirectory.com/skills/tools-only-140-claude-f32703df)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# Hook Tests

pytest tests for oh-my-claude hooks.

## Framework

pytest >=8.0 with coverage via pytest-cov

## Running

```bash
cd tests/oh-my-claude/hooks
uv run --with pytest pytest . -v
```

## Structure

```python
class TestFeatureName:
    """Tests for specific feature."""

    def test_scenario_description(self, fixture):
        """Expected behavior in plain English."""
        # Arrange
        # Act
        # Assert
```

## Naming

| Element | Convention |
|---------|------------|
| Files | `test_{module_name}.py` |
| Classes | `Test{FeatureName}` |
| Methods | `test_{scenario}` |

## Fixtures (conftest.py)

| Fixture | Purpose |
|---------|---------|
| `temp_project` | Generic temp directory |
| `nodejs_project` | Creates package.json |
| `python_project` | Creates pyproject.toml |
| `sample_transcript` | Mock conversation data |
| `sample_todos` | Mock todo list |

## Mocking Patterns

**Environment variables:**
```python
def test_with_env(self, monkeypatch):
    monkeypatch.setenv("OMC_THRESHOLD", "200")
    monkeypatch.delenv("OTHER_VAR", raising=False)
```

**Function mocking:**
```python
from unittest.mock import patch

def test_with_mock(self):
    with patch("module.function", return_value="mocked"):
        result = call_code()
```

**Filesystem:**
```python
def test_file_ops(self, tmp_path):
    f = tmp_path / "test.txt"
    f.write_text("content")
```

**Stdout capture:**
```python
def test_output(self, capsys):
    function_that_prints()
    captured = capsys.readouterr()
    assert "expected" in captured.out
```

## Coverage Focus

- Threshold boundaries (under, at, over)
- Edge cases (empty, binary, unicode, symlinks)
- Error paths (missing files, invalid JSON)
- Environment variable combinations

## Anti-Patterns

- Don't test implementation details
- Don't share mutable state between tests
- Don't mock what you can test directly
- Don't skip error path coverage

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.