/usr/lib/python3/dist-packages/pytest_catchlog-1.2.2.egg-info/PKG-INFO is in python3-pytest-catchlog 1.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | Metadata-Version: 1.1
Name: pytest-catchlog
Version: 1.2.2
Summary: py.test plugin to catch log messages. This is a fork of pytest-capturelog.
Home-page: https://github.com/eisensheng/pytest-catchlog
Author: Arthur Skowronek (Fork Author)
Author-email: eisensheng@mailbox.org
License: MIT License
Description: pytest-catchlog
===============
.. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/eisensheng/pytest-catchlog
:target: https://gitter.im/eisensheng/pytest-catchlog?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
py.test plugin to catch log messages. This is a fork of `pytest-capturelog`_.
.. _`pytest-capturelog`: https://pypi.python.org/pypi/pytest-capturelog/
Installation
------------
The `pytest-catchlog`_ package may be installed with pip or easy_install::
pip install pytest-catchlog
easy_install pytest-catchlog
.. _`pytest-catchlog`: http://pypi.python.org/pypi/pytest-catchlog/
Usage
-----
If the plugin is installed log messages are captured by default and for
each failed test will be shown in the same manner as captured stdout and
stderr.
Running without options::
py.test test_pytest_catchlog.py
Shows failed tests like so::
----------------------- Captured stdlog call ----------------------
test_pytest_catchlog.py 26 INFO text going to logger
----------------------- Captured stdout call ----------------------
text going to stdout
----------------------- Captured stderr call ----------------------
text going to stderr
==================== 2 failed in 0.02 seconds =====================
By default each captured log message shows the module, line number,
log level and message. Showing the exact module and line number is
useful for testing and debugging. If desired the log format and date
format can be specified to anything that the logging module supports.
Running pytest specifying formatting options::
py.test --log-format="%(asctime)s %(levelname)s %(message)s" \
--log-date-format="%Y-%m-%d %H:%M:%S" test_pytest_catchlog.py
Shows failed tests like so::
----------------------- Captured stdlog call ----------------------
2010-04-10 14:48:44 INFO text going to logger
----------------------- Captured stdout call ----------------------
text going to stdout
----------------------- Captured stderr call ----------------------
text going to stderr
==================== 2 failed in 0.02 seconds =====================
These options can also be customized through a configuration file::
[pytest]
log_format = %(asctime)s %(levelname)s %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
Although the same effect could be achieved through the ``addopts`` setting,
using dedicated options should be preferred since the latter doesn't
force other developers to have ``pytest-catchlog`` installed (while at
the same time, ``addopts`` approach would fail with 'unrecognized arguments'
error). Command line arguments take precedence.
Further it is possible to disable reporting logs on failed tests
completely with::
py.test --no-print-logs test_pytest_catchlog.py
Shows failed tests in the normal manner as no logs were captured::
----------------------- Captured stdout call ----------------------
text going to stdout
----------------------- Captured stderr call ----------------------
text going to stderr
==================== 2 failed in 0.02 seconds =====================
Inside tests it is possible to change the log level for the captured
log messages. This is supported by the ``caplog`` funcarg::
def test_foo(caplog):
caplog.set_level(logging.INFO)
pass
By default the level is set on the handler used to catch the log
messages, however as a convenience it is also possible to set the log
level of any logger::
def test_foo(caplog):
caplog.set_level(logging.CRITICAL, logger='root.baz')
pass
It is also possible to use a context manager to temporarily change the
log level::
def test_bar(caplog):
with caplog.at_level(logging.INFO):
pass
Again, by default the level of the handler is affected but the level
of any logger can be changed instead with::
def test_bar(caplog):
with caplog.at_level(logging.CRITICAL, logger='root.baz'):
pass
Lastly all the logs sent to the logger during the test run are made
available on the funcarg in the form of both the LogRecord instances
and the final log text. This is useful for when you want to assert on
the contents of a message::
def test_baz(caplog):
func_under_test()
for record in caplog.records:
assert record.levelname != 'CRITICAL'
assert 'wally' not in caplog.text
For all the available attributes of the log records see the
``logging.LogRecord`` class.
You can also resort to ``record_tuples`` if all you want to do is to ensure,
that certain messages have been logged under a given logger name with a
given severity and message::
def test_foo(caplog):
logging.getLogger().info('boo %s', 'arg')
assert caplog.record_tuples == [
('root', logging.INFO, 'boo arg'),
]
Changelog
=========
List of notable changes between pytest-catchlog releases.
.. %UNRELEASED_SECTION%
`1.2.2`_
-------------
Released on 2016-01-24 UTC.
- [Bugfix] `#30`_ `#31`_ - Fix ``unicode`` vs ``str`` compatibility issues between Python2 and Python3.
(Thanks goes to `@sirex`_ for reporting the issue and providing a fix!)
.. _#30: https://github.com/eisensheng/pytest-catchlog/issues/30
.. _#31: https://github.com/eisensheng/pytest-catchlog/issues/31
.. _@sirex: https://github.com/sirex
`1.2.1`_
-------------
Released on 2015-12-07.
- [Bugfix] #18 - Allow ``caplog.records()`` to be modified. Thanks to Eldar Abusalimov for the PR and Marco Nenciarini for reporting the issue.
- [Bugfix] #15 #17 - Restore Python 2.6 compatibility. (Thanks to Marco Nenciarini!)
.. attention::
Deprecation warning: the following objects (i.e. functions, properties)
are slated for removal in the next major release.
- ``caplog.at_level`` and ``caplog.set_level`` should be used instead of
``caplog.atLevel`` and ``caplog.setLevel``.
The methods ``caplog.atLevel`` and ``caplog.setLevel`` are still
available but deprecated and not supported since they don't follow
the PEP8 convention for method names.
- ``caplog.text``, ``caplog.records`` and
``caplog.record_tuples`` were turned into properties.
They still can be used as regular methods for backward compatibility,
but that syntax is considered deprecated and scheduled for removal in
the next major release.
Version 1.2
-----------
Released on 2015-11-08.
- [Feature] #6 - Configure logging message and date format through ini file.
- [Feature] #7 - Also catch logs from setup and teardown stages.
- [Feature] #7 - Replace deprecated ``__multicall__`` use to support future Py.test releases.
- [Feature] #11 - reintroduce ``setLevel`` and ``atLevel`` to retain backward compatibility with pytest-capturelog. Also the members ``text``, ``records`` and ``record_tuples`` of the ``caplog`` fixture can be used as properties now.
Special thanks for this release goes to Eldar Abusalimov. He provided all of the changed features.
Version 1.1
-----------
Released on 2015-06-07.
- #2 - Explicitly state Python3 support and add configuration for running
tests with tox on multiple Python versions. (Thanks to Jeremy Bowman!)
- Add an option to silence logs completely on the terminal.
Version 1.0
-----------
Released on 2014-12-08.
- Add ``record_tuples`` for comparing recorded log entries against expected
log entries with their logger name, severity and formatted message.
Keywords: py.test pytest logging
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Testing
|