Skip to content

Instantly share code, notes, and snippets.

View hpk42's full-sized avatar

holger krekel hpk42

View GitHub Profile
if self.name_version:
name, version = self.name_version
else:
name, version = pkginfo.name, pkginfo.version
+def get_name_version_doczip(path):
+ path = str(path)
+ DOCZIPSUFFIX = ".doc.zip"
+ assert path.endswith(DOCZIPSUFFIX)
+ fn = path[:-len(DOCZIPSUFFIX)]
+ # for documentation we presume that versions do not contain "-"
+ name, version = re.match("(.*)-([a-zA-Z0-9\.!]+)", fn).groups()
+ return name, version
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.
"""
[tox]
envlist = py27-{threads,greenlets}
[testenv]
commands = echo {envname}
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")
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 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):
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)
@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
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):