diff options
| author | Jason Kirtland <jek@discorporate.us> | 2008-01-12 22:03:42 +0000 |
|---|---|---|
| committer | Jason Kirtland <jek@discorporate.us> | 2008-01-12 22:03:42 +0000 |
| commit | 17d3c8764e020379e54053bca0b0a2bc71d48aa0 (patch) | |
| tree | 0b46f1ddc57292b8f5bfbc28ab1679230f63e426 /test/base | |
| parent | c194962019d1bc7322e20b82c33aa1bab3bc2a28 (diff) | |
| download | sqlalchemy-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/base')
| -rw-r--r-- | test/base/alltests.py | 4 | ||||
| -rw-r--r-- | test/base/dependency.py | 23 | ||||
| -rw-r--r-- | test/base/except.py | 5 | ||||
| -rw-r--r-- | test/base/utils.py | 19 |
4 files changed, 24 insertions, 27 deletions
diff --git a/test/base/alltests.py b/test/base/alltests.py index d14b694cb..803b8ea3c 100644 --- a/test/base/alltests.py +++ b/test/base/alltests.py @@ -1,4 +1,4 @@ -import testbase +import testenv; testenv.configure_for_tests() import unittest def suite(): @@ -18,4 +18,4 @@ def suite(): if __name__ == '__main__': - testbase.main(suite()) + testenv.main(suite()) diff --git a/test/base/dependency.py b/test/base/dependency.py index fedf0ba15..56767dc84 100644 --- a/test/base/dependency.py +++ b/test/base/dependency.py @@ -1,4 +1,4 @@ -import testbase +import testenv; testenv.configure_for_tests() import sqlalchemy.topological as topological from sqlalchemy import util from testlib import * @@ -20,7 +20,7 @@ class DependencySortTest(PersistTest): assert False, "Tuple not in dependency tree: " + str(tuple) + " " + str(node) for c in node[2]: assert_tuple(tuple, c) - + for tuple in tuples: assert_tuple(list(tuple), node) @@ -37,7 +37,7 @@ class DependencySortTest(PersistTest): assert_unique(c) assert_unique(node) assert len(collection) == 0 - + def testsort(self): rootnode = 'root' node2 = 'node2' @@ -92,7 +92,7 @@ class DependencySortTest(PersistTest): head1 = topological.sort_as_tree(tuples, [node1, node2, node3]) head2 = topological.sort_as_tree(tuples, [node3, node1, node2]) head3 = topological.sort_as_tree(tuples, [node3, node2, node1]) - + # TODO: figure out a "node == node2" function #self.assert_(str(head1) == str(head2) == str(head3)) print "\n" + str(head1) @@ -114,7 +114,7 @@ class DependencySortTest(PersistTest): self.assert_sort(tuples, head) def testsort5(self): - # this one, depenending on the weather, + # this one, depenending on the weather, node1 = 'node1' #'00B94190' node2 = 'node2' #'00B94990' node3 = 'node3' #'00B9A9B0' @@ -153,7 +153,7 @@ class DependencySortTest(PersistTest): allitems = [node1, node2, node3, node4] head = topological.sort_as_tree(tuples, allitems, with_cycles=True) self.assert_sort(tuples, head) - + def testcircular2(self): # this condition was arising from ticket:362 # and was not treated properly by topological sort @@ -170,20 +170,19 @@ class DependencySortTest(PersistTest): ] head = topological.sort_as_tree(tuples, [], with_cycles=True) self.assert_sort(tuples, head) - + def testcircular3(self): nodes = {} tuples = [('Question', 'Issue'), ('ProviderService', 'Issue'), ('Provider', 'Question'), ('Question', 'Provider'), ('ProviderService', 'Question'), ('Provider', 'ProviderService'), ('Question', 'Answer'), ('Issue', 'Question')] head = topological.sort_as_tree(tuples, [], with_cycles=True) self.assert_sort(tuples, head) - + def testbigsort(self): tuples = [] for i in range(0,1500, 2): tuples.append((i, i+1)) head = topological.sort_as_tree(tuples, []) - - - + + if __name__ == "__main__": - testbase.main() + testenv.main() diff --git a/test/base/except.py b/test/base/except.py index 671597b5f..84b84793c 100644 --- a/test/base/except.py +++ b/test/base/except.py @@ -1,6 +1,5 @@ """Tests exceptions and DB-API exception wrapping.""" - -import testbase +import testenv; testenv.configure_for_tests() import sys, unittest import exceptions as stdlib_exceptions from sqlalchemy import exceptions as sa_exceptions @@ -75,4 +74,4 @@ class WrapTest(unittest.TestCase): if __name__ == "__main__": - testbase.main() + testenv.main() diff --git a/test/base/utils.py b/test/base/utils.py index 6e1b58c4a..5ebc33921 100644 --- a/test/base/utils.py +++ b/test/base/utils.py @@ -1,4 +1,4 @@ -import testbase +import testenv; testenv.configure_for_tests() import unittest from sqlalchemy import util, sql, exceptions from testlib import * @@ -35,18 +35,18 @@ class OrderedDictTest(PersistTest): self.assert_(o.keys() == ['a', 'b', 'c', 'd', 'e', 'f']) self.assert_(o.values() == [1, 2, 3, 4, 5, 6]) -class OrderedSetTest(PersistTest): +class OrderedSetTest(PersistTest): def test_mutators_against_iter(self): # testing a set modified against an iterator o = util.OrderedSet([3,2, 4, 5]) - - self.assertEquals(o.difference(iter([3,4])), util.OrderedSet([2,5])) - self.assertEquals(o.intersection(iter([3,4, 6])), util.OrderedSet([3, 4])) + self.assertEquals(o.difference(iter([3,4])), + util.OrderedSet([2,5])) + self.assertEquals(o.intersection(iter([3,4, 6])), + util.OrderedSet([3, 4])) + self.assertEquals(o.union(iter([3,4, 6])), + util.OrderedSet([2, 3, 4, 5, 6])) - self.assertEquals(o.union(iter([3,4, 6])), util.OrderedSet([2, 3, 4, 5, 6])) - - class ColumnCollectionTest(PersistTest): def test_in(self): cc = sql.ColumnCollection() @@ -119,7 +119,6 @@ class EqOverride(object): return self.value != other.value else: return True - class HashEqOverride(object): def __init__(self, value=None): self.value = value @@ -307,4 +306,4 @@ class DictlikeIteritemsTest(unittest.TestCase): if __name__ == "__main__": - testbase.main() + testenv.main() |
