test and fix pastebin xmlrpc import name missmatch, fixes #87
This commit is contained in:
		
							parent
							
								
									9d3e51af9f
								
							
						
					
					
						commit
						69dfc75572
					
				|  | @ -38,7 +38,11 @@ def pytest_unconfigure(config): | ||||||
|         del tr._tw.__dict__['write'] |         del tr._tw.__dict__['write'] | ||||||
| 
 | 
 | ||||||
| def getproxy(): | 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): | def pytest_terminal_summary(terminalreporter): | ||||||
|     if terminalreporter.config.option.pastebin != "failed": |     if terminalreporter.config.option.pastebin != "failed": | ||||||
|  |  | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
|  | import pytest | ||||||
| 
 | 
 | ||||||
| class TestPasting: | class TestPasting: | ||||||
|     def pytest_funcarg__pastebinlist(self, request): |     def pytest_funcarg__pastebinlist(self, request): | ||||||
|  | @ -45,3 +46,14 @@ class TestPasting: | ||||||
|         for x in 'test_fail test_skip skipped'.split(): |         for x in 'test_fail test_skip skipped'.split(): | ||||||
|             assert s.find(x), (s, x) |             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') | ||||||
|  | 
 | ||||||
|  |      | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue