Thomas Hisch
84569ca4da
Merge pull request #5311 from thisch/coloredcaplog
...
Use same code for setting up cli/non-cli formatter
2019-05-29 22:18:43 +02:00
Thomas Hisch
d4b85da8c7
Use same code for setting up cli/non-cli formatter
...
A method _create_formatter was introduced that is used for both the
log_cli_formatter and the log_formatter.
Consequences of this commit are:
* Captured logs that are output for each failing test are formatted
using the ColoredLevelFromatter.
* The formatter used for writing to a file still uses the non-colored
logging.Formatter class.
2019-05-28 21:30:34 +02:00
Thomas Hisch
bed3918cbc
Revert "logging: Simple impl of multline pretty printing"
...
This reverts commit 31dfbb4668
.
2019-05-24 09:11:03 +02:00
Thomas Hisch
31dfbb4668
logging: Simple impl of multline pretty printing
2019-05-24 09:09:09 +02:00
Anthony Sottile
dc75b6af47
Use fix-encoding-pragma pre-commit hook
2019-05-14 15:56:31 -07:00
Pulkit Goyal
7e08e09473
logging: improve default logging format (issue5214)
...
We improve the following things in the logging format:
* Show module name instead of just the filename
* show level of logging as the first thing
* show lineno attached to module:file details
Thanks to @blueyed who suggested this on the github issue.
It's my first contribution and I have added myself to AUTHORS.
I also added to a changelog file.
2019-05-08 21:37:59 +03:00
Bruno Oliveira
057c97812b
Merge pull request #4975 from blueyed/verbose-fixes
...
Fix usages of "verbose" option
2019-03-26 18:38:39 -03:00
Daniel Hahler
538efef1ba
logging: close log_file_handler
...
While it should be closed in logging's shutdown [1], the following would
still issue a ResourceWarning:
```
import logging
log_file_handler = logging.FileHandler("temp.log", mode="w", encoding="UTF-8")
root_logger = logging.getLogger()
root_logger.addHandler(log_file_handler)
root_logger.removeHandler(log_file_handler)
root_logger.error("error")
del log_file_handler
```
It looks like the weakref might get lost for some reason.
See https://github.com/pytest-dev/pytest/pull/4981/commits/92ffe42b45 / #4981
for more information.
1: c1419578a1/Lib/logging/__init__.py (L2107-L2139)
2019-03-26 18:24:19 +01:00
Daniel Hahler
23146e7527
Fix usages of "verbose" option
...
With `-qq` `bool(config.getoption("verbose"))` is True; it needs to be
checked for `> 0`.
2019-03-26 10:11:25 +01:00
Daniel Hahler
0d31e852b1
Run isort
2019-03-01 14:24:18 +01:00
Andras Mitzki
b26b731498
Logging: Make pytest_runtest_logreport() available for logging
...
Signed-off-by: Andras Mitzki <andras.mitzki@balabit.com>
2019-02-22 05:14:44 +01:00
Bruno Oliveira
986dd84375
LoggingPlugin: Support to customize log_file from hook ( #4752 )
...
LoggingPlugin: Support to customize log_file from hook
2019-02-16 12:01:21 -02:00
Andras Mitzki
e3824d23bc
LoggingPlugin: Expose setting log_file_handler
...
- This patch allows to set log_file (path) from hook
Signed-off-by: Thomas Hisch
Signed-off-by: Andras Mitzki <andras.mitzki@balabit.com>
2019-02-15 16:05:10 +01:00
Thomas Hisch
ddbea29c12
Remove terminal_reporter workaround from logging.py
...
The workaround was removed from the logging module by creating python
properties for verbosity related settings in the terminalreporter.
Closes : #4733
2019-02-07 22:52:07 +01:00
Thomas Hisch
7b8fd0cc12
Refactor _setup_cli_logging code
...
Change the indentation in _setup_cli_logging by moving the
self._log_cli_enabled check outside of the _setup_cli_logging method.
2019-02-07 19:39:12 +01:00
Thomas Hisch
0ce8b910ca
Only call _setup_cli_logging in __init__
...
Supersedes #4719
2019-02-06 07:03:40 +01:00
Anthony Sottile
e5f823a3a7
fixes for flake8 3.7
2019-01-29 21:11:15 -08:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Daniel Hahler
2cf4c67e45
doc: fix caplog: s/methods/properties/
2018-10-24 23:57:11 +02:00
Vincent Barbaresi
db106d6085
Fix logging usage in hooks pytest_sessionstart/finish #3340
2018-10-20 09:55:10 +02:00
Anthony Sottile
ab8907f6f5
s/comparision/comparison/g [ci skip]
2018-10-16 17:23:29 -07:00
Bruno Oliveira
9a3836a0cf
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-09 19:34:04 -03:00
Anthony Sottile
65545d8fb2
Manual fixups of black formatting
2018-10-08 10:12:42 -07:00
Anthony Sottile
1caf6d5907
Upgrade pre-commit hooks
2018-10-08 10:10:46 -07:00
Bruno Oliveira
56d0b5a7e2
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-09-22 18:14:36 -03:00
Daniel Hahler
e7eb7e799b
logging: del item.catch_log_handler only in teardown
...
Without this caplog.record_tuples etc is not available anymore when using
`--pdb`.
2018-09-19 17:17:47 +02:00
Thomas Hisch
18cc74b8d0
Remove useless comment
2018-09-19 15:18:37 +02:00
Thomas Hisch
e967d4587a
Add support for logging in collection-phase
...
The logging plugin does not output log messages generated during the
collection-phase when live-logging is enabled. This fixes this.
Fixes #3964
2018-09-18 20:18:24 +02:00
Bruno Oliveira
5cf7d1dba2
"suspend" method of capture fixture private
...
Also change the context-manager to global_and_fixture_disabled to
better convey its meaning
2018-08-18 11:38:08 -03:00
Bruno Oliveira
f674217c43
Moved dummy_context_manager to compat module
2018-08-18 11:15:58 -03:00
victor
eb2d074530
Black changes.
2018-08-18 14:27:09 +02:00
victor
9fa7745795
Refactor, tests passing.
2018-08-18 13:40:08 +02:00
Victor
090f67a980
Refactored implementation and updated tests.
2018-08-17 13:41:26 +02:00
Victor
2b71cb9c38
Added activation/deactivation of capture fixture in logging emit.
2018-08-17 00:26:12 +02:00
Bruno Oliveira
7696d5371a
Merge remote-tracking branch 'upstream/master' into features
2018-07-04 18:49:35 -03:00
Victor
342f2cdc17
Fixes #3630
2018-06-29 16:09:39 +02:00
Ronny Pfannschmidt
89e0a3ec27
merge from master to features
2018-06-26 17:01:05 +02:00
Anthony Sottile
cbaa7dd56a
Upgrade pre-commit hooks except pyupgrade
2018-06-26 06:35:27 -07:00
Wil Cooley
3615977608
Add `messages` property to `caplog` fixture.
2018-06-14 12:22:33 -07:00
Ronny Pfannschmidt
eaa882f3d5
switch to src layout
2018-05-26 09:10:38 +02:00