Skip to content

Instantly share code, notes, and snippets.

View hpk42's full-sized avatar
💭
blacklivesmatter

holger krekel hpk42

💭
blacklivesmatter
View GitHub Profile
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.
"""
+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
if self.name_version:
name, version = self.name_version
else:
name, version = pkginfo.name, pkginfo.version
Collecting devpi-common<2.1,>=2.0.6.dev2 (from devpi-server==2.2.0.dev1)
Could not find a version that satisfies the requirement devpi-common<2.1,>=2.0.6.dev2 (from devpi-server==2.2.0.dev1) (from versions: 1.2, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6.dev2)
from setuptools import setup
if __name__ == "__main__":
setup(
name='pytest-pep8',
description='pytest plugin to check PEP8 requirements',
long_description=open("README.txt").read(),
license="MIT license",
version='1.0.7.dev1',
author='Holger Krekel and Ronny Pfannschmidt',