try: import xmlrpc.client as xmlrpclib except ImportError: import xmlrpclib # legacy Python # Third party imports import pytest import webtest # Local Imports from pypiserver import __main__, bottle import tests.test_core as test_core # Enable logging to detect any problems with it ## __main__.init_logging(level=logging.NOTSET) hp = HTMLParser() @pytest.fixture() def _app(app): return app.module @pytest.fixture def app(tmpdir): from pypiserver import app return app(root=tmpdir.strpath, authenticated=[]) @pytest.fixture
import contextlib import glob import logging import os import subprocess import pytest import webtest from pypiserver import __main__, bottle # Enable logging to detect any problems with it ## __main__.init_logging(level=logging.NOTSET) @pytest.fixture() def _app(app): return app.module @pytest.fixture def app(tmpdir): from pypiserver import app return app(root=tmpdir.strpath, authenticated=[]) @pytest.fixture def testapp(app):
def test_init_logging_with_none_stream_doesnt_add_stream_handler(dummy_logger): assert not dummy_logger.handlers __main__.init_logging(stream=None, logger=dummy_logger) assert not dummy_logger.handlers
import xmlrpc.client as xmlrpclib except ImportError: import xmlrpclib # legacy Python # Third party imports import pytest import webtest # Local Imports from pypiserver import __main__, bottle import tests.test_core as test_core # Enable logging to detect any problems with it ## __main__.init_logging() @pytest.fixture() def _app(app): return app.module @pytest.fixture def app(tmpdir): from pypiserver import app return app(root=tmpdir.strpath, authenticated=[]) @pytest.fixture
def test_init_logging_with_stream(dummy_logger): assert not dummy_logger.handlers __main__.init_logging(stream=sys.stdout, logger=dummy_logger) assert isinstance(dummy_logger.handlers[0], logging.StreamHandler) assert dummy_logger.handlers[0].stream is sys.stdout