Skip to content

Instantly share code, notes, and snippets.

View hpk42's full-sized avatar

holger krekel hpk42

View GitHub Profile
diff --git a/_pytest/assertion/__init__.py b/_pytest/assertion/__init__.py
--- a/_pytest/assertion/__init__.py
+++ b/_pytest/assertion/__init__.py
@@ -78,10 +78,12 @@ def pytest_runtest_setup(item):
for new_expl in hook_result:
if new_expl:
- # Don't include pageloads of data unless we are very verbose (-vv)
+ # Don't include pageloads of data unless we
+ # are very verbose (-vv)
>>> import xmlrpclib
>>> proxy=xmlrpclib.ServerProxy("https://preview-pypi.python.org/pypi")
>>> d=proxy.list_packages_with_serial()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
diff --git a/_pytest/python.py b/_pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -594,12 +594,14 @@ class CallSpec2(object):
self._globalparam = _notexists
self._arg2scopenum = {} # used for sorting parametrized resources
self.keywords = {}
+ self.indices = {}
def copy(self, metafunc):
@hpk42
hpk42 / py34-0.log
Created January 27, 2014 12:52
description
actionid=py34
msg=getenv
cmdargs=['C:\\Users\\Administrator\\0\\Scripts\\virtualenv.EXE', '--setuptools', '--python', 'c:\\python34\\python.exe', 'py34']
env={'TMP': 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2', 'COMPUTERNAME': 'WIN2', '_OLD_VIRTUAL_PATH': 'C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;c:\\\\python27;c:\\\\python27\\scripts', 'USERDOMAIN': 'WIN2', 'PSMODULEPATH': 'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 45 Stepping 7, GenuineIntel', 'PROGRAMFILES': 'C:\\Program Files', 'PROCESSOR_REVISION': '2d07', 'SYSTEMROOT': 'C:\\Windows', 'PATH': 'c:\\users\\admini~1\\appdata\\local\\temp\\2\\devpi-test3\\pytest-2.5.2.dev1\\.tox\\py34\\Scripts;C:\\Users\\Administrator\\0\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\Wind
def test_monkeypatch_context_processor_with_exception(monkeypatch):
monkeypatch = MonkeyPatch()
class TerribleException(Exception):
pass
@staticmethod
def _func():
raise TerribleException('terrible!')
mp.setattr(SampleNew, 'hello', _func)
def test_monkeypatch_context_processor_with_exception(monkeypatch):
class TerribleException(Exception):
pass
@staticmethod
def _func():
raise TerribleException('terrible!')
monkeypatch.setattr(SampleNew, 'hello', _func)
with pytest.raises(TerribleException):
devpi.localhost - - [26/May/2014 10:45:21] "GET /+search?query=devpi+use++path%3A%2Fhpk%2Fdev%2Fdevpi&page=1 HTTP/1.1" 500 59
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/hpk/venv/0/local/lib/python2.7/site-packages/pyramid/router.py", line 242, in __call__
response = self.invoke_subrequest(request, use_tweens=True)
File "/home/hpk/venv/0/local/lib/python2.7/site-packages/pyramid/router.py", line 217, in invoke_subrequest
response = handle_request(request)
File "/home/hpk/venv/0/local/lib/python2.7/site-packages/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
def devpiserver_auth(userconfig, user, password):
# if we know about the user and password is correct
return dict(status="ok", groups=[...])
# if we know about the user and the password is incorrect
return dict(status="reject")
# if we don't know about the user
# other plugins may still try verification
return dict(status="unknown")
[tox]
envlist = py27-{threads,greenlets}
[testenv]
commands = echo {envname}
def add_method_wrapper(cls, wrapper_func):
""" Substitute the function named "wrapperfunc.__name__" at class
"cls" with a function that wraps the call to the original function.
Return an undo function which can be called to reset the class to use
the old method again.
wrapper_func is called with the same arguments as the method
it wraps and its result is used as a wrap_controller for
calling the original function.
"""