pytest-loguru 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytest_loguru/__init__.py +1 -0
- pytest_loguru/_version.py +16 -0
- pytest_loguru/plugin.py +28 -0
- pytest_loguru-0.4.0.dist-info/METADATA +54 -0
- pytest_loguru-0.4.0.dist-info/RECORD +8 -0
- pytest_loguru-0.4.0.dist-info/WHEEL +4 -0
- pytest_loguru-0.4.0.dist-info/entry_points.txt +2 -0
- pytest_loguru-0.4.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from ._version import version as __version__ # noqa: F401
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# file generated by setuptools_scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
TYPE_CHECKING = False
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from typing import Tuple, Union
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '0.4.0'
|
|
16
|
+
__version_tuple__ = version_tuple = (0, 4, 0)
|
pytest_loguru/plugin.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from typing import Iterator # pragma: no cover
|
|
2
|
+
|
|
3
|
+
import pytest # pragma: no cover
|
|
4
|
+
from _pytest.logging import LogCaptureFixture # pragma: no cover
|
|
5
|
+
from loguru import logger # pragma: no cover
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.fixture
|
|
9
|
+
def caplog(caplog: LogCaptureFixture) -> Iterator[LogCaptureFixture]:
|
|
10
|
+
"""Emitting logs from loguru's logger.log means that they will not show up in
|
|
11
|
+
caplog which only works with Python's standard logging. This adds the same
|
|
12
|
+
LogCaptureHandler being used by caplog to hook into loguru.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
caplog (LogCaptureFixture): caplog fixture
|
|
16
|
+
|
|
17
|
+
Yields:
|
|
18
|
+
LogCaptureFixture
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def filter_(record):
|
|
22
|
+
return record["level"].no >= caplog.handler.level
|
|
23
|
+
|
|
24
|
+
handler_id = logger.add(
|
|
25
|
+
caplog.handler, level=0, format="{message}", filter=filter_
|
|
26
|
+
)
|
|
27
|
+
yield caplog
|
|
28
|
+
logger.remove(handler_id)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: pytest-loguru
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Pytest Loguru
|
|
5
|
+
Project-URL: Homepage, https://github.com/mcarans/pytest-loguru
|
|
6
|
+
Author: Michael Rans
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: loguru,py.test,pytest
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Framework :: Pytest
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Operating System :: Unix
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Requires-Dist: loguru
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest; extra == 'test'
|
|
32
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
[](https://github.com/mcarans/pytest-loguru/actions?query=workflow%3Abuild)
|
|
36
|
+
[](https://pypi.python.org/pypi/pytest-loguru)
|
|
37
|
+
[](https://anaconda.org/conda-forge/pytest-loguru)
|
|
38
|
+
[](https://codecov.io/gh/mcarans/pytest-loguru)
|
|
39
|
+
[](https://github.com/astral-sh/ruff)
|
|
40
|
+
|
|
41
|
+
### pytest-loguru
|
|
42
|
+
|
|
43
|
+
A pytest plugin to add support for loguru to pytest's caplog fixture.
|
|
44
|
+
|
|
45
|
+
You can install it from pypi with:
|
|
46
|
+
```
|
|
47
|
+
pip install pytest-loguru
|
|
48
|
+
```
|
|
49
|
+
and from conda-forge with:
|
|
50
|
+
```
|
|
51
|
+
conda install -c conda-forge pytest-loguru
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Note that coverage is 100% but the coverage tool is confused by the fixture decorator.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pytest_loguru/__init__.py,sha256=11ozJKiUsqDCZ3_mcAHhGYUyGK_Unl54djVSBBExFB4,59
|
|
2
|
+
pytest_loguru/_version.py,sha256=j90u3VVU4UrJf1fgMUhaZarHK_Do2XGYXr-vZvOFzVo,411
|
|
3
|
+
pytest_loguru/plugin.py,sha256=87DKj5HZK1d81LSvPpgd91e9OU_WNEOVfP9ghXS1o0A,852
|
|
4
|
+
pytest_loguru-0.4.0.dist-info/METADATA,sha256=ydm1hsT3RT8eDjJigbitbMfNFsyxqxAnpOyJqYZj4_E,2334
|
|
5
|
+
pytest_loguru-0.4.0.dist-info/WHEEL,sha256=bq9SyP5NxIRA9EpQgMCd-9RmPHWvbH-4lTDGwxgIR64,87
|
|
6
|
+
pytest_loguru-0.4.0.dist-info/entry_points.txt,sha256=LjzOoWvfWfZpG2q2oerk2ltSl_rDAnreRWg2I2WbF9k,41
|
|
7
|
+
pytest_loguru-0.4.0.dist-info/licenses/LICENSE,sha256=UwZP1VT1tDhDIprOoPiHkGF6ooCDyeAEv8Q1p3xYyWw,1061
|
|
8
|
+
pytest_loguru-0.4.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Mike
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|