Failures are correctly injected into the log entries.
(self)
| 76 | assert "foo=42 event='event'" == bl.err("event", foo=42) |
| 77 | |
| 78 | def test_errWithFailure(self): |
| 79 | """ |
| 80 | Failures are correctly injected into the log entries. |
| 81 | """ |
| 82 | bl = build_bl( |
| 83 | processors=[EventAdapter(dictRenderer=KeyValueRenderer())] |
| 84 | ) |
| 85 | try: |
| 86 | raise ValueError |
| 87 | except ValueError: |
| 88 | # Use str() for comparison to avoid tricky |
| 89 | # deep-compares of Failures. |
| 90 | assert str( |
| 91 | ( |
| 92 | (), |
| 93 | { |
| 94 | "_stuff": Failure(ValueError()), |
| 95 | "_why": "foo=42 event='event'", |
| 96 | }, |
| 97 | ) |
| 98 | ) == str(bl.err("event", foo=42)) |
| 99 | |
| 100 | |
| 101 | class TestExtractStuffAndWhy: |
nothing calls this directly
no test coverage detected