summaryrefslogtreecommitdiff
path: root/test/perf/threaded_compile.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-01-12 22:03:42 +0000
committerJason Kirtland <jek@discorporate.us>2008-01-12 22:03:42 +0000
commit17d3c8764e020379e54053bca0b0a2bc71d48aa0 (patch)
tree0b46f1ddc57292b8f5bfbc28ab1679230f63e426 /test/perf/threaded_compile.py
parentc194962019d1bc7322e20b82c33aa1bab3bc2a28 (diff)
downloadsqlalchemy-17d3c8764e020379e54053bca0b0a2bc71d48aa0.tar.gz
- testbase is gone, replaced by testenv
- Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase - testing.db has the configured db - Fixed up the perf/* scripts
Diffstat (limited to 'test/perf/threaded_compile.py')
-rw-r--r--test/perf/threaded_compile.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/perf/threaded_compile.py b/test/perf/threaded_compile.py
index 13ec31fd6..6809f2560 100644
--- a/test/perf/threaded_compile.py
+++ b/test/perf/threaded_compile.py
@@ -1,21 +1,21 @@
"""test that mapper compilation is threadsafe, including
-when additional mappers are created while the existing
+when additional mappers are created while the existing
collection is being compiled."""
-import testbase
+import testenv; testenv.simple_setup()
from sqlalchemy import *
from sqlalchemy.orm import *
import thread, time
from sqlalchemy.orm import mapperlib
-from testlib import *
+
meta = MetaData('sqlite:///foo.db')
-t1 = Table('t1', meta,
+t1 = Table('t1', meta,
Column('c1', Integer, primary_key=True),
Column('c2', String(30))
)
-
+
t2 = Table('t2', meta,
Column('c1', Integer, primary_key=True),
Column('c2', String(30)),
@@ -32,13 +32,13 @@ class T1(object):
class T2(object):
pass
-
+
class FakeLock(object):
def acquire(self):pass
def release(self):pass
# uncomment this to disable the mutex in mapper compilation;
-# should produce thread collisions
+# should produce thread collisions
#mapperlib._COMPILE_MUTEX = FakeLock()
def run1():
@@ -62,7 +62,7 @@ def run3():
class_mapper(Foo).compile()
foo()
time.sleep(.05)
-
+
mapper(T1, t1, properties={'t2':relation(T2, backref="t1")})
mapper(T2, t2)
print "START"
@@ -74,4 +74,3 @@ for j in range(0, 5):
thread.start_new_thread(run3, ())
print "WAIT"
time.sleep(5)
-