Modified:
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
branches/unhork/grassyknoll/tests/test_backends/test_SqliteCollection.py
Log:
Guarded slower collection tests with an environment variable,
GK_TEST_RUN_SLOW, which must be set to run the full test suite; drops the
test suite time from two minutes to 15 seconds. The only collection tests
which run without that variable set are the SqliteCollection :memory: tests.
Modified:
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
==============================================================================
---
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
(original)
+++
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
Tue Dec 30 10:08:50 2008
@@ -4,6 +4,7 @@
L{test_DictCollection} for concrete implementations testing an actual
backend.
"""
+import os
import new
import sys
import copy
@@ -191,6 +192,7 @@
test_mixin_classes=None,
test_class_name_suffix='',
include_client_tests=False,
+ test_is_slow=True,
**kwargs):
"""
Creates and binds to the caller's globals a set of collection test
classes.
@@ -213,8 +215,13 @@
@param test_mixin_classes: An iterable of classes to mixin to the
generated classes. Generally this is used for mixing in a class for query
tests, since these are specific to each collection.
@type test_mixin_classes: anything iterable
+ @param test_is_slow: A bool indicating whether the test is slow; if it
is, it will only be run if the environment variable GK_TEST_RUN_SLOW is set.
+ @type test_is_slow: bool
+
Additional kwargs will be passed as the test classes' class dictionary.
"""
+ if test_is_slow and 'GK_TEST_RUN_SLOW' not in os.environ:
+ return # Don't create the test classes.
if not test_base_classes:
raise ValueError('test_base_classes must be a non-empty list.')
if not issubclass(collectionClass, Collection.Collection):
Modified:
branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
==============================================================================
--- branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
(original)
+++ branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
Tue Dec 30 10:08:50 2008
@@ -116,12 +116,14 @@
test_mixin_classes=None,
test_class_name_suffix='',
include_client_tests=False,
+ test_is_slow=True,
**kwargs):
simple_location = ObjectTemplate(table=simple_table, **kwargs)
SimpleCollectionTests.makeTestClasses(collectionClass,
simple_location, environment,
test_base_classes=test_base_classes,
test_mixin_classes=test_mixin_classes,
test_class_name_suffix=test_class_name_suffix,
+ test_is_slow=test_is_slow,
include_client_tests=include_client_tests)
shakes_location = ObjectTemplate(table=shakes_table, **kwargs)
@@ -129,6 +131,7 @@
test_base_classes=test_base_classes,
test_mixin_classes=test_mixin_classes,
test_class_name_suffix=test_class_name_suffix,
+ test_is_slow=test_is_slow,
include_client_tests=include_client_tests)
if test_mixin_classes is None:
@@ -138,5 +141,6 @@
test_base_classes=test_base_classes,
test_mixin_classes=test_mixin_classes + [NSFQueryTests],
test_class_name_suffix=test_class_name_suffix,
+ test_is_slow=test_is_slow,
include_client_tests=include_client_tests)
Modified:
branches/unhork/grassyknoll/tests/test_backends/test_SqliteCollection.py
==============================================================================
---
branches/unhork/grassyknoll/tests/test_backends/test_SqliteCollection.py
(original)
+++
branches/unhork/grassyknoll/tests/test_backends/test_SqliteCollection.py
Tue Dec 30 10:08:50 2008
@@ -7,7 +7,7 @@
makeTestClasses(SqliteCollection, globals(), path=TestFilenameFactory)
makeTestClasses(SqliteCollection, globals(), path=':memory:',
- test_class_name_suffix='Memory')
+ test_class_name_suffix='Memory', test_is_slow=False)
makeTestClasses(SqliteCollection, globals(), path=':memory:',
__init_kwargs__={'synchronous_writes': False,