This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Pytest-logger is a pytest plugin configuring handlers for loggers from Python logging module.

You can install pytest-logger via pip from PyPI:

$ [sudo] pip install pytest-logger

Plugin puts logs on per-logger basis to:

  • standard output,
  • files within log-specific directory under pytest’s tmpdir_factory session directory.

You can setup plugin using hooks:

#conftest.py
import os

def pytest_logger_stdoutloggers(item):
    return ['foo', 'bar']

def pytest_logger_fileloggers(item):
    return ['foo', 'bar']

def pytest_logger_logdirlink(config):
    return os.path.join(os.path.dirname(__file__), 'mylogs')

have logging tests or libraries (including fixtures):

#test_something.py
import pytest
import logging

foo = logging.getLogger('foo')
foo.setLevel(logging.INFO)

bar = logging.getLogger('bar')

@pytest.yield_fixture(scope='session')
def session_thing():
    foo.info('constructing session thing')
    yield
    foo.info('destroying session thing')

@pytest.yield_fixture
def testcase_thing():
    foo.info('constructing testcase thing')
    yield
    foo.info('destroying testcase thing')

def test_one(session_thing, testcase_thing):
    foo.info('one executes')
    bar.warning('this test does nothing aside from logging')

def test_two(session_thing, testcase_thing):
    foo.info('two executes')
    bar.warning('neither does this')

and expect output in terminal (if not captured):

$ py.test -s -v
(...)
test_something.py::test_one
00:00.001 inf foo: constructing session thing
00:00.001 inf foo: constructing testcase thing
00:00.002 inf foo: one executes
00:00.002 wrn bar: this test does nothing aside from logging
PASSED
00:00.002 inf foo: destroying testcase thing

test_something.py::test_two
00:00.000 inf foo: constructing testcase thing
00:00.000 inf foo: two executes
00:00.000 wrn bar: neither does this
PASSED
00:00.001 inf foo: destroying testcase thing
00:00.001 inf foo: destroying session thing
(...)

and - the same - in filesystem:

$ file mylogs
mylogs: symbolic link to `/tmp/pytest-of-aurzenligl/pytest-48/logs'

$ tree mylogs
mylogs
`-- test_something.py
    |-- test_one
    |   |-- bar
    |   `-- foo
    `-- test_two
        |-- bar
        `-- foo

Distributed under the terms of the MIT license, pytest-logger is free and open source software.

Release History

Release History

0.1.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pytest_logger-0.1.3-py2.py3-none-any.whl (8.2 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Dec 28, 2016
pytest-logger-0.1.3.tar.gz (19.6 kB) Copy SHA256 Checksum SHA256 Source Dec 28, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting