From 69dfc755722ed52b699a23eab5b6d48b4392e556 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 14 Nov 2011 17:51:12 +0100 Subject: [PATCH] test and fix pastebin xmlrpc import name missmatch, fixes #87 --- _pytest/pastebin.py | 6 +++++- testing/test_pastebin.py | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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') + +