Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ pip install -e .
- Works seamlessly with `pytest.approx()`, `mock.ANY` and any custom comparator utilities
- Handles complex nested structures intelligently

### **Zero Configuration**
- **Just install and it works** - no setup required
- Can be disabled with `--no-deepassert` flag
- **Drop-in replacement** for standard assertions
### **Simple Opt-In**
- **Enable with `--deepassert` flag** - disabled by default to avoid interference
- No additional configuration needed
- **Drop-in replacement** for standard assertions when enabled

---

Expand Down Expand Up @@ -225,7 +225,7 @@ E }

</details>

#### ✨ **With pytest-deepassert** (with `pytest -vv`)
#### ✨ **With pytest-deepassert** (with `pytest --deepassert -vv`)

```
example_test1.py::test_user_profile_comparison FAILED
Expand Down Expand Up @@ -355,30 +355,25 @@ E [... standard pytest diff continues below ...]

## 💡 Usage

### **Automatic Enhancement**

Once installed, `pytest-deepassert` **automatically** enhances all your `==` assertions inside the tests. No code changes required!


### **Configuration Options**

#### Disable deepassert
After installation, enable `pytest-deepassert` by passing the `--deepassert` flag when running pytest:

```bash
pytest --no-deepassert
pytest --deepassert
```

This will enhance all your `==` assertions inside the tests. No code changes required!

---

## Configuration

`pytest-deepassert` works out of the box with **zero configuration**. However, you can customize its behavior:
`pytest-deepassert` is **disabled by default** to avoid any interference with your existing test suite. Enable it when needed:

### Command Line Options

| Option | Description |
|--------|-------------|
| `--no-deepassert` | Disable pytest-deepassert for this test run |
| `--deepassert` | Enable pytest-deepassert for this test run |


---
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "pytest-deepassert"
version = "0.2.0"
version = "0.3.0"
description = "A pytest plugin for enhanced assertion reporting with detailed diffs"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
6 changes: 3 additions & 3 deletions src/pytest_deepassert/plugin/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def pytest_addoption(parser): # type: ignore
"""Add command line options for pytest-deepassert."""
group = parser.getgroup("deepassert")
group.addoption(
"--no-deepassert",
"--deepassert",
action="store_true",
help="Disable deep assertion diffs from pytest-deepassert",
help="Enable deep assertion diffs from pytest-deepassert",
)


Expand All @@ -31,7 +31,7 @@ def pytest_assertrepr_compare(
A list of strings representing the formatted comparison output,
or None if not handled.
"""
if config.getoption("--no-deepassert"):
if not config.getoption("--deepassert"):
return None

if op != "==":
Expand Down