/usr/lib/python2.7/dist-packages/sphinx_gallery/tests/conftest.py is in python-sphinx-gallery 0.1.13-1ubuntu1.
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 | # -*- coding: utf-8 -*-
"""
Pytest fixtures
"""
from __future__ import division, absolute_import, print_function
import collections
import logging
import pytest
import sphinx_gallery.docs_resolv
import sphinx_gallery.gen_gallery
import sphinx_gallery.gen_rst
from sphinx_gallery import sphinx_compatibility
Params = collections.namedtuple('Params', 'args kwargs')
class FakeSphinxApp:
def __init__(self):
self.calls = collections.defaultdict(list)
def status_iterator(self, *args, **kwargs):
self.calls['status_iterator'].append(Params(args, kwargs))
for it in args[0]:
yield it
def warning(self, *args, **kwargs):
self.calls['warning'].append(Params(args, kwargs))
def warn(self, *args, **kwargs):
self.calls['warn'].append(Params(args, kwargs))
def info(self, *args, **kwargs):
self.calls['info'].append(Params(args, kwargs))
def verbose(self, *args, **kwargs):
self.calls['verbose'].append(Params(args, kwargs))
def debug(self, *args, **kwargs):
self.calls['debug'].append(Params(args, kwargs))
@pytest.fixture
def fakesphinxapp():
orig_app = sphinx_gallery.sphinx_compatibility._app
sphinx_gallery.sphinx_compatibility._app = app = FakeSphinxApp()
try:
yield app
finally:
sphinx_gallery.sphinx_compatibility._app = orig_app
@pytest.fixture
def log_collector():
orig_dr_logger = sphinx_gallery.docs_resolv.logger
orig_gg_logger = sphinx_gallery.gen_gallery.logger
orig_gr_logger = sphinx_gallery.gen_rst.logger
app = FakeSphinxApp()
sphinx_gallery.docs_resolv.logger = app
sphinx_gallery.gen_gallery.logger = app
sphinx_gallery.gen_rst.logger = app
try:
yield app
finally:
sphinx_gallery.docs_resolv.logger = orig_dr_logger
sphinx_gallery.gen_gallery.logger = orig_gg_logger
sphinx_gallery.gen_rst.logger = orig_gr_logger
|