Exemplo n.º 1
0
 def test_main(self):
     handler = PrintHandler()
     for level in range(0, 70, 10):
         record = logging.LogRecord("foo", level, "a.py", 45, "bar", None,
                                    None)
         with capture_output():
             handler.handle(record)
Exemplo n.º 2
0
 def test_main(self):
     handler = PrintHandler()
     for level in range(0, 70, 10):
         record = logging.LogRecord(
             "foo", level, "a.py", 45, "bar", None, None)
         with capture_output():
             handler.handle(record)
Exemplo n.º 3
0
def _init_python():
    if PY2 or is_release():
        MinVersions.PYTHON2.check(sys.version_info)
    else:
        # for non release builds we allow Python3
        MinVersions.PYTHON3.check(sys.version_info)

    if is_osx():
        # We build our own openssl on OSX and need to make sure that
        # our own ca file is used in all cases as the non-system openssl
        # doesn't use the system certs
        install_urllib2_ca_file()

    if is_windows():
        # Not really needed on Windows as pygi-aio seems to work fine, but
        # wine doesn't have certs which we use for testing.
        install_urllib2_ca_file()

    if is_windows() and os.sep != "\\":
        # In the MSYS2 console MSYSTEM is set, which breaks os.sep/os.path.sep
        # If you hit this do a "setup.py clean -all" to get rid of the
        # bytecode cache then start things with "MSYSTEM= ..."
        raise AssertionError("MSYSTEM is set (%r)" % environ.get("MSYSTEM"))

    if is_windows():
        # gdbm is broken under msys2, this makes shelve use another backend
        sys.modules["gdbm"] = None
        sys.modules["_gdbm"] = None

    logging.getLogger().addHandler(PrintHandler())