Daniel Hahler
ddc8edffbc
logging: minor typing, rename function
...
`get_log_level_for_setting` reflects better what the function does, and
it does not require a (trivial) docstring.
2020-03-01 22:02:46 +01:00
Daniel Hahler
bdd22fdd52
logging: improve help for log_level
2020-03-01 22:02:46 +01:00
Bruno Oliveira
78baa7b575
Merge remote-tracking branch 'upstream/master' into mm
...
Conflicts:
src/_pytest/main.py
src/_pytest/mark/structures.py
src/_pytest/python.py
testing/test_main.py
testing/test_parseopt.py
2020-02-11 19:22:28 -03:00
Daniel Hahler
30cb598e9c
Typing around/from types in docs ( #6699 )
2020-02-09 11:42:07 +01:00
Ran Benita
a435faad5c
Merge branch 'master' into master-to-features
2020-01-31 11:27:06 +02:00
Daniel Hahler
88b800355a
typing: pytest_collection
2020-01-30 19:58:43 +01:00
Vinay Calastry
afbaee7649
Deprecate --no-print-logs option
2019-12-14 16:46:30 -08:00
Daniel Hahler
e7320c6b54
Merge pull request #5926 from AtakamaLLC/optional-multiline
...
Add log-auto-indent option to control multiline formatting
2019-11-06 00:35:24 +01:00
Daniel Hahler
7f1af84f47
Merge master into features
...
Conflicts:
src/_pytest/logging.py
2019-10-27 02:06:36 +01:00
Ran Benita
0b8c35516f
Replace py.io.TextIO with io.StringIO
...
In Python3, py.io.TextIO is just an alias to io.StringIO. Remove the
indirection.
2019-10-26 16:33:57 +03:00
Michael Krebs
1f5b454355
Add log-auto-indent option to control multiline formatting
2019-10-25 11:31:33 -04:00
Ran Benita
583c2a2f9b
Fix check_untyped_defs errors in logging
2019-10-23 14:20:15 +03:00
Daniel Hahler
71a7fd02a5
doc: caplog: add caplog.messages
2019-10-15 16:18:50 +02:00
Bruno Oliveira
355eb5adfb
Small cleanups on _pytest.compat
...
Small improvements and cleanups
2019-06-15 10:06:37 -03:00
Thomas Hisch
577b0dffe7
Fix verbosity bug in --collect-only
2019-06-05 20:10:16 -03:00
Anthony Sottile
5dcf85c17e
manual: remove dependence on six
2019-06-03 12:08:02 -03:00
Anthony Sottile
a91fe1fedd
pre-commit run pyupgrade --all-files
2019-06-03 12:08:02 -03:00
Anthony Sottile
3f1ec520fc
pre-commit run reorder-python-imports --all-files
2019-06-03 12:08:01 -03:00
Anthony Sottile
5034399d7a
pre-commit run fix-encoding-pragma --all-files
2019-06-03 12:08:01 -03:00
Thomas Hisch
ef053193b5
logging: Extend LEVELNAME_FMT_REGEX
2019-06-03 05:53:19 +02:00
Bruno Oliveira
4d49ba6529
Drop Python 2.7 and 3.4 support
...
* Update setup.py requires and classifiers
* Drop Python 2.7 and 3.4 from CI
* Update docs dropping 2.7 and 3.4 support
* Fix mock imports and remove tests related to pypi's mock module
* Add py27 and 34 support docs to the sidebar
* Remove usage of six from tmpdir
* Remove six.PY* code blocks
* Remove sys.version_info related code
* Cleanup compat
* Remove obsolete safe_str
* Remove obsolete __unicode__ methods
* Remove compat.PY35 and compat.PY36: not really needed anymore
* Remove unused UNICODE_TYPES
* Remove Jython specific code
* Remove some Python 2 references from docs
Related to #5275
2019-06-02 14:39:11 -03:00
Thomas Hisch
ea3ebec117
logging: Improve formatting of multiline message
2019-05-29 23:21:14 +02:00
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