]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
reorganized unit tests into subdirectories
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 5 Jun 2006 17:25:51 +0000 (17:25 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 5 Jun 2006 17:25:51 +0000 (17:25 +0000)
55 files changed:
CHANGES
README.unittests [new file with mode: 0644]
test/alltests.py
test/base/__init__.py [new file with mode: 0644]
test/base/alltests.py [new file with mode: 0644]
test/base/attributes.py [moved from test/attributes.py with 100% similarity]
test/base/dependency.py [moved from test/dependency.py with 100% similarity]
test/base/historyarray.py [moved from test/historyarray.py with 100% similarity]
test/engine/__init__.py [new file with mode: 0644]
test/engine/alltests.py [new file with mode: 0644]
test/engine/autoconnect_engine.py [moved from test/autoconnect_engine.py with 100% similarity]
test/engine/parseconnect.py [moved from test/parseconnect.py with 100% similarity]
test/engine/pool.py [moved from test/pool.py with 100% similarity]
test/engine/proxy_engine.py [moved from test/proxy_engine.py with 100% similarity]
test/engine/reflection.py [moved from test/reflection.py with 100% similarity]
test/engine/transaction.py [moved from test/transaction.py with 100% similarity]
test/ext/__init__.py [new file with mode: 0644]
test/ext/activemapper.py [moved from test/activemapper.py with 100% similarity]
test/ext/alltests.py [new file with mode: 0644]
test/ext/legacy_objectstore.py [moved from test/legacy_objectstore.py with 100% similarity]
test/ext/sqlsoup.py [moved from test/sqlsoup.py with 100% similarity]
test/ext/wsgi_test.py [moved from test/wsgi_test.py with 100% similarity]
test/orm/__init__.py [new file with mode: 0644]
test/orm/alltests.py [new file with mode: 0644]
test/orm/association.py [moved from test/association.py with 100% similarity]
test/orm/cascade.py [moved from test/cascade.py with 100% similarity]
test/orm/cycles.py [moved from test/cycles.py with 100% similarity]
test/orm/eagertest1.py [moved from test/eagertest1.py with 100% similarity]
test/orm/eagertest2.py [moved from test/eagertest2.py with 100% similarity]
test/orm/entity.py [moved from test/entity.py with 100% similarity]
test/orm/inheritance.py [moved from test/inheritance.py with 100% similarity]
test/orm/inheritance2.py [moved from test/inheritance2.py with 100% similarity]
test/orm/inheritance3.py [moved from test/inheritance3.py with 100% similarity]
test/orm/lazytest1.py [moved from test/lazytest1.py with 100% similarity]
test/orm/manytomany.py [moved from test/manytomany.py with 100% similarity]
test/orm/mapper.py [moved from test/mapper.py with 100% similarity]
test/orm/objectstore.py [moved from test/objectstore.py with 100% similarity]
test/orm/onetoone.py [moved from test/onetoone.py with 100% similarity]
test/orm/poly_linked_list.py [moved from test/poly_linked_list.py with 100% similarity]
test/orm/polymorph.py [moved from test/polymorph.py with 100% similarity]
test/orm/relationships.py [moved from test/relationships.py with 100% similarity]
test/orm/selectresults.py [moved from test/selectresults.py with 100% similarity]
test/orm/sessioncontext.py [moved from test/sessioncontext.py with 100% similarity]
test/perf/masscreate.py [moved from test/masscreate.py with 100% similarity]
test/perf/masscreate2.py [moved from test/masscreate2.py with 100% similarity]
test/perf/massload.py [moved from test/massload.py with 100% similarity]
test/sql/__init__.py [new file with mode: 0644]
test/sql/alltests.py [new file with mode: 0644]
test/sql/case_statement.py [moved from test/case_statement.py with 100% similarity]
test/sql/defaults.py [moved from test/defaults.py with 100% similarity]
test/sql/indexes.py [moved from test/indexes.py with 100% similarity]
test/sql/query.py [moved from test/query.py with 100% similarity]
test/sql/select.py [moved from test/select.py with 100% similarity]
test/sql/selectable.py [moved from test/selectable.py with 100% similarity]
test/sql/testtypes.py [moved from test/testtypes.py with 98% similarity]

diff --git a/CHANGES b/CHANGES
index 6b196f44025e461a379c5975815972b5a12496c1..d22e19fc3a5d4a850959a6f60ad1ccc696fc5fde 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -21,6 +21,9 @@ more correctly documented
 - restored global_connect() function, attaches to a DynamicMetaData
 instance called "default_metadata".  leaving MetaData arg to Table
 out will use the default metadata.
+- fixes to session cascade behavior, entity_name propigation
+- reorganized unittests into subdirectories
+
 0.2.1
 - "pool" argument to create_engine() properly propigates
 - fixes to URL, raises exception if not parsed, does not pass blank
diff --git a/README.unittests b/README.unittests
new file mode 100644 (file)
index 0000000..74c7cca
--- /dev/null
@@ -0,0 +1,42 @@
+To run unit tests (assuming unix-style commandline, adjust as needed for windows):
+
+cd into the SQLAlchemy distribution directory.
+
+Set up the PYTHONPATH:
+
+    export PYTHONPATH=./lib/:./test/
+
+To run all tests:
+
+    python test/alltests.py
+
+Help is available via:
+
+    python test/alltests.py --help
+
+    usage: alltests.py [options] files...
+    
+    options:
+      -h, --help            show this help message and exit
+      --dburi=DBURI         database uri (overrides --db)
+      --db=DB               prefab database uri (sqlite, sqlite_file, postgres,
+                       mysql, oracle, oracle8, mssql)
+      --mockpool            use mock pool
+      --verbose             full debug echoing
+      --noecho              Disable SQL statement echoing
+      --quiet               be totally quiet
+      --nothreadlocal       dont use thread-local mod
+      --enginestrategy=ENGINESTRATEGY
+                       engine strategy (plain or threadlocal, defaults to SA
+                       default)
+    
+
+Any unittest module can be run directly from the module file (same commandline options):
+
+    python test/orm/mapper.py
+
+Additionally, to run a speciic test within the module, specify it as ClassName.methodname:
+
+    python test/orm/mapper.py MapperTest.testget
+
+
index 183fc1492415815f379a049ceea08f1844f5c517..147d26d2cf88e861ef6c3b0cb5cddaafe8589a1c 100644 (file)
@@ -1,71 +1,16 @@
 import testbase
 import unittest
 
-def suite():
-    modules_to_test = (
-        # core utilities
-        'historyarray',
-        'attributes', 
-        'dependency',
-
-        # connectivity, execution
-        'pool', 
-        'transaction',
-        
-        # schema/tables
-        'reflection', 
-        'testtypes',
-        'indexes',
+import orm.alltests as orm
+import base.alltests as base
+import sql.alltests as sql
+import engine.alltests as engine
+import ext.alltests as ext
 
-        # SQL syntax
-        'select',
-        'selectable',
-        'case_statement', 
-        
-        # assorted round-trip tests
-        'query',
-        
-        # defaults, sequences (postgres/oracle)
-        'defaults',
-        
-        # ORM selecting
-        'mapper',
-        'selectresults',
-        'lazytest1',
-        'eagertest1',
-        'eagertest2',
-        
-        # ORM persistence
-        'sessioncontext', 
-        'objectstore',
-        'cascade',
-        'relationships',
-        'association',
-        
-        # cyclical ORM persistence
-        'cycles',
-        'poly_linked_list',
-        
-        # more select/persistence, backrefs
-        'entity',
-        'manytomany',
-        'onetoone',
-        'inheritance',
-        'inheritance2',
-       'inheritance3',
-        'polymorph',
-        
-        # extensions
-        'proxy_engine',
-        'activemapper',
-        'sqlsoup'
-        
-        #'wsgi_test',
-        
-        )
+def suite():
     alltests = unittest.TestSuite()
-    for module in map(__import__, modules_to_test):
-        alltests.addTest(unittest.findTestCases(module, suiteClass=None))
+    for suite in (base, engine, sql, orm, ext):
+        alltests.addTest(suite.suite())
     return alltests
 
 
diff --git a/test/base/__init__.py b/test/base/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/base/alltests.py b/test/base/alltests.py
new file mode 100644 (file)
index 0000000..2ef5b87
--- /dev/null
@@ -0,0 +1,21 @@
+import testbase
+import unittest
+
+def suite():
+    modules_to_test = (
+        # core utilities
+        'base.historyarray',
+        'base.attributes', 
+        'base.dependency',
+        )
+    alltests = unittest.TestSuite()
+    for name in modules_to_test:
+        mod = __import__(name)
+        for token in name.split('.')[1:]:
+            mod = getattr(mod, token)
+        alltests.addTest(unittest.findTestCases(mod, suiteClass=None))
+    return alltests
+
+
+if __name__ == '__main__':
+    testbase.runTests(suite())
similarity index 100%
rename from test/attributes.py
rename to test/base/attributes.py
similarity index 100%
rename from test/dependency.py
rename to test/base/dependency.py
diff --git a/test/engine/__init__.py b/test/engine/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/engine/alltests.py b/test/engine/alltests.py
new file mode 100644 (file)
index 0000000..c63cb28
--- /dev/null
@@ -0,0 +1,28 @@
+import testbase
+import unittest
+
+
+def suite():
+    modules_to_test = (
+        # connectivity, execution
+       'engine.parseconnect',
+        'engine.pool', 
+        'engine.transaction',
+        
+        # schema/tables
+        'engine.reflection', 
+
+       'engine.proxy_engine'
+        )
+    alltests = unittest.TestSuite()
+    for name in modules_to_test:
+        mod = __import__(name)
+        for token in name.split('.')[1:]:
+            mod = getattr(mod, token)
+        alltests.addTest(unittest.findTestCases(mod, suiteClass=None))
+    return alltests
+
+
+
+if __name__ == '__main__':
+    testbase.runTests(suite())
similarity index 100%
rename from test/pool.py
rename to test/engine/pool.py
similarity index 100%
rename from test/reflection.py
rename to test/engine/reflection.py
diff --git a/test/ext/__init__.py b/test/ext/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/ext/alltests.py b/test/ext/alltests.py
new file mode 100644 (file)
index 0000000..67513f0
--- /dev/null
@@ -0,0 +1,19 @@
+import testbase
+import unittest
+
+def suite():
+    modules_to_test = (
+       'ext.activemapper',
+       'ext.sqlsoup'
+        )
+    alltests = unittest.TestSuite()
+    for name in modules_to_test:
+        mod = __import__(name)
+        for token in name.split('.')[1:]:
+            mod = getattr(mod, token)
+        alltests.addTest(unittest.findTestCases(mod, suiteClass=None))
+    return alltests
+
+
+if __name__ == '__main__':
+    testbase.runTests(suite())
similarity index 100%
rename from test/sqlsoup.py
rename to test/ext/sqlsoup.py
similarity index 100%
rename from test/wsgi_test.py
rename to test/ext/wsgi_test.py
diff --git a/test/orm/__init__.py b/test/orm/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/orm/alltests.py b/test/orm/alltests.py
new file mode 100644 (file)
index 0000000..4c038f1
--- /dev/null
@@ -0,0 +1,39 @@
+import testbase
+import unittest
+
+def suite():
+    modules_to_test = (
+        'orm.mapper',
+        'orm.selectresults',
+        'orm.lazytest1',
+        'orm.eagertest1',
+        'orm.eagertest2',
+        
+        'orm.sessioncontext', 
+        'orm.objectstore',
+        'orm.cascade',
+        'orm.relationships',
+        'orm.association',
+        
+        'orm.cycles',
+        'orm.poly_linked_list',
+
+       'orm.entity',
+       'orm.manytomany',
+       'orm.onetoone',
+       'orm.inheritance',
+       'orm.inheritance2',
+       'orm.inheritance3',
+       'orm.polymorph'        
+        )
+    alltests = unittest.TestSuite()
+    for name in modules_to_test:
+        mod = __import__(name)
+        for token in name.split('.')[1:]:
+            mod = getattr(mod, token)
+        alltests.addTest(unittest.findTestCases(mod, suiteClass=None))
+    return alltests
+
+
+if __name__ == '__main__':
+    testbase.runTests(suite())
similarity index 100%
rename from test/association.py
rename to test/orm/association.py
similarity index 100%
rename from test/cascade.py
rename to test/orm/cascade.py
similarity index 100%
rename from test/cycles.py
rename to test/orm/cycles.py
similarity index 100%
rename from test/eagertest1.py
rename to test/orm/eagertest1.py
similarity index 100%
rename from test/eagertest2.py
rename to test/orm/eagertest2.py
similarity index 100%
rename from test/entity.py
rename to test/orm/entity.py
similarity index 100%
rename from test/inheritance.py
rename to test/orm/inheritance.py
similarity index 100%
rename from test/lazytest1.py
rename to test/orm/lazytest1.py
similarity index 100%
rename from test/manytomany.py
rename to test/orm/manytomany.py
similarity index 100%
rename from test/mapper.py
rename to test/orm/mapper.py
similarity index 100%
rename from test/objectstore.py
rename to test/orm/objectstore.py
similarity index 100%
rename from test/onetoone.py
rename to test/orm/onetoone.py
similarity index 100%
rename from test/polymorph.py
rename to test/orm/polymorph.py
similarity index 100%
rename from test/masscreate.py
rename to test/perf/masscreate.py
similarity index 100%
rename from test/masscreate2.py
rename to test/perf/masscreate2.py
similarity index 100%
rename from test/massload.py
rename to test/perf/massload.py
diff --git a/test/sql/__init__.py b/test/sql/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/sql/alltests.py b/test/sql/alltests.py
new file mode 100644 (file)
index 0000000..23a7a62
--- /dev/null
@@ -0,0 +1,32 @@
+import testbase
+import unittest
+
+
+def suite():
+    modules_to_test = (
+        'sql.testtypes',
+        'sql.indexes',
+
+        # SQL syntax
+        'sql.select',
+        'sql.selectable',
+        'sql.case_statement', 
+        
+        # assorted round-trip tests
+        'sql.query',
+        
+        # defaults, sequences (postgres/oracle)
+        'sql.defaults',
+        )
+    alltests = unittest.TestSuite()
+    for name in modules_to_test:
+        mod = __import__(name)
+        for token in name.split('.')[1:]:
+            mod = getattr(mod, token)
+        alltests.addTest(unittest.findTestCases(mod, suiteClass=None))
+    return alltests
+
+
+
+if __name__ == '__main__':
+    testbase.runTests(suite())
similarity index 100%
rename from test/defaults.py
rename to test/sql/defaults.py
similarity index 100%
rename from test/indexes.py
rename to test/sql/indexes.py
similarity index 100%
rename from test/query.py
rename to test/sql/query.py
similarity index 100%
rename from test/select.py
rename to test/sql/select.py
similarity index 100%
rename from test/selectable.py
rename to test/sql/selectable.py
similarity index 98%
rename from test/testtypes.py
rename to test/sql/testtypes.py
index db1fbca206e05e9cc8a6dd937e07194ed8deff9a..f369bd384040c7c33014c9807116f777ad5292c7 100644 (file)
@@ -4,6 +4,14 @@ from testbase import PersistTest, AssertMixin
 import testbase
 import sqlalchemy.engine.url as url
 
+import sqlalchemy.types
+
+# TODO: cant get cPickle to pickle the "Foo" class from this module,
+# now that its moved
+import pickle
+sqlalchemy.types.pickle = pickle
+
+
 db = testbase.db
 
 class MyType(types.TypeEngine):