Skip to content

Commit 488c8f7

Browse files
authored
Merge pull request #9 from alexkuzmik/alexkuzmik/turn-off-plugin-by-default-and-fix-report-appending
[NA] Invert default config to require --deepassert flag for plugin to work…
2 parents bda827c + f424556 commit 488c8f7

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ pip install -e .
8686
- Works seamlessly with `pytest.approx()`, `mock.ANY` and any custom comparator utilities
8787
- Handles complex nested structures intelligently
8888

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

9494
---
9595

@@ -225,7 +225,7 @@ E }
225225

226226
</details>
227227

228-
#### **With pytest-deepassert** (with `pytest -vv`)
228+
#### **With pytest-deepassert** (with `pytest --deepassert -vv`)
229229

230230
```
231231
example_test1.py::test_user_profile_comparison FAILED
@@ -355,30 +355,25 @@ E [... standard pytest diff continues below ...]
355355

356356
## 💡 Usage
357357

358-
### **Automatic Enhancement**
359-
360-
Once installed, `pytest-deepassert` **automatically** enhances all your `==` assertions inside the tests. No code changes required!
361-
362-
363-
### **Configuration Options**
364-
365-
#### Disable deepassert
358+
After installation, enable `pytest-deepassert` by passing the `--deepassert` flag when running pytest:
366359

367360
```bash
368-
pytest --no-deepassert
361+
pytest --deepassert
369362
```
370363

364+
This will enhance all your `==` assertions inside the tests. No code changes required!
365+
371366
---
372367

373368
## Configuration
374369

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

377372
### Command Line Options
378373

379374
| Option | Description |
380375
|--------|-------------|
381-
| `--no-deepassert` | Disable pytest-deepassert for this test run |
376+
| `--deepassert` | Enable pytest-deepassert for this test run |
382377

383378

384379
---

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "pytest-deepassert"
7-
version = "0.2.0"
7+
version = "0.3.0"
88
description = "A pytest plugin for enhanced assertion reporting with detailed diffs"
99
readme = "README.md"
1010
requires-python = ">=3.8"

src/pytest_deepassert/plugin/hook.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ def pytest_addoption(parser): # type: ignore
88
"""Add command line options for pytest-deepassert."""
99
group = parser.getgroup("deepassert")
1010
group.addoption(
11-
"--no-deepassert",
11+
"--deepassert",
1212
action="store_true",
13-
help="Disable deep assertion diffs from pytest-deepassert",
13+
help="Enable deep assertion diffs from pytest-deepassert",
1414
)
1515

1616

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

3737
if op != "==":

0 commit comments

Comments
 (0)