From: Mike Bayer Date: Sat, 4 May 2013 20:35:47 +0000 (-0400) Subject: py3k specific syntax moved into an exec X-Git-Tag: rel_0_9_0b1~304^2~13^2~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87ee86514eedad1b3df787f5a3705492d82acbee;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git py3k specific syntax moved into an exec --- diff --git a/test/orm/test_instrumentation.py b/test/orm/test_instrumentation.py index 56ad4908bb..c3d24ebe7d 100644 --- a/test/orm/test_instrumentation.py +++ b/test/orm/test_instrumentation.py @@ -540,31 +540,6 @@ class NativeInstrumentationTest(fixtures.ORMTest): class Py3KFunctionInstTest(fixtures.ORMTest): __requires__ = ("python3", ) -# start Py3K - def _kw_only_fixture(self): - class A(object): - def __init__(self, a, *, b, c): - self.a = a - self.b = b - self.c = c - return self._instrument(A) - - def _kw_plus_posn_fixture(self): - class A(object): - def __init__(self, a, *args, b, c): - self.a = a - self.b = b - self.c = c - return self._instrument(A) - - def _kw_opt_fixture(self): - class A(object): - def __init__(self, a, *, b, c="c"): - self.a = a - self.b = b - self.c = c - return self._instrument(A) -# end Py3K def _instrument(self, cls): manager = instrumentation.register_class(cls) @@ -615,6 +590,36 @@ class Py3KFunctionInstTest(fixtures.ORMTest): cls, "a", "b", c="c" ) +if util.py3k: + _locals = {} + exec(""" +def _kw_only_fixture(self): + class A(object): + def __init__(self, a, *, b, c): + self.a = a + self.b = b + self.c = c + return self._instrument(A) + +def _kw_plus_posn_fixture(self): + class A(object): + def __init__(self, a, *args, b, c): + self.a = a + self.b = b + self.c = c + return self._instrument(A) + +def _kw_opt_fixture(self): + class A(object): + def __init__(self, a, *, b, c="c"): + self.a = a + self.b = b + self.c = c + return self._instrument(A) +""", _locals) + for k in _locals: + setattr(Py3KFunctionInstTest, k, _locals[k]) + class MiscTest(fixtures.ORMTest): """Seems basic, but not directly covered elsewhere!"""