We render our log records before sending it back to logging. Therefore we must clear `LogRecord.args` otherwise the user gets an `TypeError: not all arguments converted during string formatting.` if they use positional formatting in stdlib logging.
(self, capsys)
| 1118 | assert isinstance(calls[0]["_record"], logging.LogRecord) |
| 1119 | |
| 1120 | def test_clears_args(self, capsys): |
| 1121 | """ |
| 1122 | We render our log records before sending it back to logging. Therefore |
| 1123 | we must clear `LogRecord.args` otherwise the user gets an |
| 1124 | `TypeError: not all arguments converted during string formatting.` if |
| 1125 | they use positional formatting in stdlib logging. |
| 1126 | """ |
| 1127 | configure_logging(None) |
| 1128 | |
| 1129 | logging.getLogger().warning("hello %s.", "world") |
| 1130 | |
| 1131 | assert ( |
| 1132 | "", |
| 1133 | "hello world. [in test_clears_args]\n", |
| 1134 | ) == capsys.readouterr() |
| 1135 | |
| 1136 | def test_pass_foreign_args_true_sets_positional_args_key(self): |
| 1137 | """ |
nothing calls this directly
no test coverage detected