fix python2.5 issues
This commit is contained in:
parent
5aa5b9748d
commit
3d00cd35fc
|
@ -1,7 +1,6 @@
|
|||
""" monkeypatching and mocking functionality. """
|
||||
|
||||
import os, sys, inspect
|
||||
import pytest
|
||||
import os, sys
|
||||
|
||||
def pytest_funcarg__monkeypatch(request):
|
||||
"""The returned ``monkeypatch`` funcarg provides these
|
||||
|
@ -28,6 +27,7 @@ def pytest_funcarg__monkeypatch(request):
|
|||
|
||||
|
||||
def derive_importpath(import_path):
|
||||
import pytest
|
||||
if not isinstance(import_path, str) or "." not in import_path:
|
||||
raise TypeError("must be absolute import path string, not %r" %
|
||||
(import_path,))
|
||||
|
@ -82,6 +82,7 @@ class monkeypatch:
|
|||
which means it will raise).
|
||||
"""
|
||||
__tracebackhide__ = True
|
||||
import inspect
|
||||
|
||||
if value is notset:
|
||||
if not isinstance(target, str):
|
||||
|
|
|
@ -37,11 +37,11 @@ def pytest_configure(config):
|
|||
# we try hard to make printing resilient against
|
||||
# later changes on FD level. (unless capturing is off/sys)
|
||||
stdout = sys.stdout
|
||||
if hasattr(os, "dup"):
|
||||
if hasattr(os, "dup") and hasattr(stdout, "fileno"):
|
||||
try:
|
||||
newstdout = py.io.dupfile(stdout, buffering=1,
|
||||
encoding=stdout.encoding)
|
||||
except ValueError:
|
||||
except (AttributeError, ValueError):
|
||||
pass
|
||||
else:
|
||||
assert stdout.encoding == newstdout.encoding
|
||||
|
|
Loading…
Reference in New Issue