some pep8 fixes

This commit is contained in:
holger krekel 2010-11-13 23:33:50 +01:00
parent 0323c5247f
commit a298cf753d
4 changed files with 8 additions and 8 deletions

View File

@ -129,7 +129,7 @@ def pytest_plugin_registered(manager, plugin):
# print "matching hook:", formatdef(method) # print "matching hook:", formatdef(method)
if fail: if fail:
name = getattr(plugin, '__name__', plugin) name = getattr(plugin, '__name__', plugin)
raise PluginValidationError("%s:\n%s" %(name, stringio.getvalue())) raise PluginValidationError("%s:\n%s" % (name, stringio.getvalue()))
class PluginValidationError(Exception): class PluginValidationError(Exception):
""" plugin failed validation. """ """ plugin failed validation. """
@ -151,7 +151,7 @@ def collectattr(obj):
return methods return methods
def formatdef(func): def formatdef(func):
return "%s%s" %( return "%s%s" % (
func.__name__, func.__name__,
inspect.formatargspec(*inspect.getargspec(func)) inspect.formatargspec(*inspect.getargspec(func))
) )

View File

@ -15,7 +15,7 @@ class DictImporter(object):
def find_module(self, fullname, path=None): def find_module(self, fullname, path=None):
if fullname in self.sources: if fullname in self.sources:
return self return self
if fullname+'.__init__' in self.sources: if fullname + '.__init__' in self.sources:
return self return self
return None return None
@ -26,7 +26,7 @@ class DictImporter(object):
s = self.sources[fullname] s = self.sources[fullname]
is_pkg = False is_pkg = False
except KeyError: except KeyError:
s = self.sources[fullname+'.__init__'] s = self.sources[fullname + '.__init__']
is_pkg = True is_pkg = True
co = compile(s, fullname, 'exec') co = compile(s, fullname, 'exec')
@ -42,11 +42,11 @@ class DictImporter(object):
def get_source(self, name): def get_source(self, name):
res = self.sources.get(name) res = self.sources.get(name)
if res is None: if res is None:
res = self.sources.get(name+'.__init__') res = self.sources.get(name + '.__init__')
return res return res
if __name__ == "__main__": if __name__ == "__main__":
if sys.version_info >= (3,0): if sys.version_info >= (3, 0):
exec("def do_exec(co, loc): exec(co, loc)\n") exec("def do_exec(co, loc): exec(co, loc)\n")
import pickle import pickle
sources = sources.encode("ascii") # ensure bytes sources = sources.encode("ascii") # ensure bytes

View File

@ -1,4 +1,4 @@
import py import pytest, py
mydir = py.path.local(__file__).dirpath() mydir = py.path.local(__file__).dirpath()
def pytest_runtest_setup(item): def pytest_runtest_setup(item):

View File

@ -57,6 +57,6 @@ commands=
[pytest] [pytest]
minversion=2.0 minversion=2.0
plugins=pytester plugins=pytester
addopts=-rfx --pyargs #addopts= -rxf --pyargs
rsyncdirs=tox.ini pytest.py _pytest testing rsyncdirs=tox.ini pytest.py _pytest testing