diff --git a/_pytest/pastebin.py b/_pytest/pastebin.py index 52d7a65e6..6369ee749 100644 --- a/_pytest/pastebin.py +++ b/_pytest/pastebin.py @@ -38,7 +38,11 @@ def pytest_unconfigure(config): del tr._tw.__dict__['write'] def getproxy(): - return py.std.xmlrpclib.ServerProxy(url.xmlrpc).pastes + if sys.version_info < (3, 0): + from xmlrpclib import ServerProxy + else: + from xmlrpc.client import ServerProxy + return ServerProxy(url.xmlrpc).pastes def pytest_terminal_summary(terminalreporter): if terminalreporter.config.option.pastebin != "failed": diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py index cc23d0e25..fc24b88c0 100644 --- a/testing/test_pastebin.py +++ b/testing/test_pastebin.py @@ -1,3 +1,4 @@ +import pytest class TestPasting: def pytest_funcarg__pastebinlist(self, request): @@ -45,3 +46,14 @@ class TestPasting: for x in 'test_fail test_skip skipped'.split(): assert s.find(x), (s, x) + +class TestRPCClient: + def pytest_funcarg__pastebin(self, request): + return request.config.pluginmanager.getplugin('pastebin') + + def test_getproxy(self, pastebin): + proxy = pastebin.getproxy() + assert proxy is not None + assert proxy.__class__.__module__.startswith('xmlrpc') + +