Merged in uweschmitt/pytest/default (pull request #194)
This commit is contained in:
		
						commit
						a8dfe34bfb
					
				| 
						 | 
					@ -57,7 +57,7 @@ class View(object):
 | 
				
			||||||
    def __getattr__(self, attr):
 | 
					    def __getattr__(self, attr):
 | 
				
			||||||
        # attributes not found in the normal hierarchy rooted on View
 | 
					        # attributes not found in the normal hierarchy rooted on View
 | 
				
			||||||
        # are looked up in the object's real class
 | 
					        # are looked up in the object's real class
 | 
				
			||||||
        return getattr(self.__obj__, attr)
 | 
					        return getattr(object.__getattribute__(self, '__obj__'), attr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __viewkey__(self):
 | 
					    def __viewkey__(self):
 | 
				
			||||||
        return self.__obj__.__class__
 | 
					        return self.__obj__.__class__
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -238,7 +238,7 @@ class EncodedFile(object):
 | 
				
			||||||
        self.write(data)
 | 
					        self.write(data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __getattr__(self, name):
 | 
					    def __getattr__(self, name):
 | 
				
			||||||
        return getattr(self.buffer, name)
 | 
					        return getattr(object.__getattribute__(self, "buffer"), name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MultiCapture(object):
 | 
					class MultiCapture(object):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -153,13 +153,14 @@ def pytest_ignore_collect(path, config):
 | 
				
			||||||
        ignore_paths.extend([py.path.local(x) for x in excludeopt])
 | 
					        ignore_paths.extend([py.path.local(x) for x in excludeopt])
 | 
				
			||||||
    return path in ignore_paths
 | 
					    return path in ignore_paths
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class HookProxy:
 | 
					class HookProxy(object):
 | 
				
			||||||
    def __init__(self, fspath, config):
 | 
					    def __init__(self, fspath, config):
 | 
				
			||||||
        self.fspath = fspath
 | 
					        self.fspath = fspath
 | 
				
			||||||
        self.config = config
 | 
					        self.config = config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __getattr__(self, name):
 | 
					    def __getattr__(self, name):
 | 
				
			||||||
        hookmethod = getattr(self.config.hook, name)
 | 
					        config = object.__getattribute__(self, "config")
 | 
				
			||||||
 | 
					        hookmethod = getattr(config.hook, name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        def call_matching_hooks(**kwargs):
 | 
					        def call_matching_hooks(**kwargs):
 | 
				
			||||||
            plugins = self.config._getmatchingplugins(self.fspath)
 | 
					            plugins = self.config._getmatchingplugins(self.fspath)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
# note: py.io capture tests where copied from
 | 
					# note: py.io capture tests where copied from
 | 
				
			||||||
# pylib 1.4.20.dev2 (rev 13d9af95547e)
 | 
					# pylib 1.4.20.dev2 (rev 13d9af95547e)
 | 
				
			||||||
from __future__ import with_statement
 | 
					from __future__ import with_statement
 | 
				
			||||||
 | 
					import pickle
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import py
 | 
					import py
 | 
				
			||||||
| 
						 | 
					@ -1022,3 +1023,12 @@ def test_error_attribute_issue555(testdir):
 | 
				
			||||||
    """)
 | 
					    """)
 | 
				
			||||||
    reprec = testdir.inline_run()
 | 
					    reprec = testdir.inline_run()
 | 
				
			||||||
    reprec.assertoutcome(passed=1)
 | 
					    reprec.assertoutcome(passed=1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_pickling_and_unpickling_enocded_file():
 | 
				
			||||||
 | 
					    # See https://bitbucket.org/hpk42/pytest/pull-request/194
 | 
				
			||||||
 | 
					    # pickle.loads() raises infinite recursion if
 | 
				
			||||||
 | 
					    # EncodedFile.__getattr__ is not implemented properly
 | 
				
			||||||
 | 
					    ef = capture.EncodedFile(None, None)
 | 
				
			||||||
 | 
					    ef_as_str = pickle.dumps(ef)
 | 
				
			||||||
 | 
					    pickle.loads(ef_as_str)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue