|
Revision 367
(checked in by fumanchu, 6 years ago)
|
Added a "managers" registry to dejavu.storage. This allows short names to be used in config instead of full class names.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
try: |
|---|
| 3 |
import _sqlite |
|---|
| 4 |
except ImportError: |
|---|
| 5 |
def run(): |
|---|
| 6 |
import warnings |
|---|
| 7 |
warnings.warn("The _sqlite module could not be imported. " |
|---|
| 8 |
"The SQLite test will not be run.") |
|---|
| 9 |
else: |
|---|
| 10 |
SM_class = "sqlite" |
|---|
| 11 |
opts = {"Database": "sqlite_zoo_test"} |
|---|
| 12 |
|
|---|
| 13 |
def run(): |
|---|
| 14 |
import zoo_fixture |
|---|
| 15 |
|
|---|
| 16 |
reload(zoo_fixture) |
|---|
| 17 |
zoo_fixture.init() |
|---|
| 18 |
zoo_fixture.run(SM_class, opts) |
|---|
| 19 |
|
|---|
| 20 |
print |
|---|
| 21 |
print "Testing SQLite with 'Perfect Dates'" |
|---|
| 22 |
opts['Perfect Dates'] = True |
|---|
| 23 |
reload(zoo_fixture) |
|---|
| 24 |
zoo_fixture.init() |
|---|
| 25 |
zoo_fixture.run(SM_class, opts) |
|---|
| 26 |
opts['Perfect Dates'] = False |
|---|
| 27 |
|
|---|
| 28 |
print |
|---|
| 29 |
print "Testing SQLite ':memory:' database..." |
|---|
| 30 |
opts['Database'] = ':memory:' |
|---|
| 31 |
reload(zoo_fixture) |
|---|
| 32 |
zoo_fixture.init() |
|---|
| 33 |
zoo_fixture.run(SM_class, opts) |
|---|
| 34 |
|
|---|
| 35 |
print |
|---|
| 36 |
print "Testing SQLite 'typeless'..." |
|---|
| 37 |
opts['Database'] = 'sqlite_zoo_test' |
|---|
| 38 |
opts['Type Adapter'] = "dejavu.storage.storesqlite.TypeAdapterSQLiteTypeless" |
|---|
| 39 |
reload(zoo_fixture) |
|---|
| 40 |
zoo_fixture.init() |
|---|
| 41 |
zoo_fixture.run(SM_class, opts) |
|---|
| 42 |
|
|---|
| 43 |
if __name__ == "__main__": |
|---|
| 44 |
run() |
|---|