Commits

Kirill Simonov committed 29365db

Cleanup sqlite3 converters after django.

  • Participants
  • Parent commits 4903637

Comments (0)

Files changed (3)

test/input/addon.yaml

   # Load `test_django_sandbox` and deploy the database
   - py: |
       # add-module-path
+      if 'sqlite' in __pbbt__:
+          import sqlite3
+          __pbbt__['sqlite3_converters'] = sqlite3.converters.copy()
       import __builtin__, sys, os, os.path
       from htsql.core.util import DB
       path = os.path.join(os.getcwd(), "test/code")
           if name.startswith(('test_django_sandbox', 'django')):
               del sys.modules[name]
       del __builtin__.sandbox
+      if 'sqlite' in __pbbt__:
+          import sqlite3
+          sqlite3.converters.clear()
+          sqlite3.converters.update(__pbbt__['sqlite3_converters'])
+          del __pbbt__['sqlite3_converters']
 
 # TWEAK.FILEDB - make a database from a set of CSV files
 - title: tweak.filedb
   - uri: /new
   - uri: /_source
     ignore: true
-  - uri: /{_source[permanent].timestamp<_source[volatile].timestamp}
+  - uri: /{_source[permanent].timestamp<=_source[volatile].timestamp}
 
   # Cleanup
   - rm:

test/output/sqlite.yaml

-#
-# This file contains expected test output data for regression tests.
-# It was generated automatically by the `regress` routine.
-#
-
 suite: sqlite
 tests:
 - suite: createdb
                     "!source"."timestamp"
              FROM "!source"
              ORDER BY 1 ASC
-        - uri: /{_source[permanent].timestamp<_source[volatile].timestamp}
-          status: 200 OK
-          headers:
-          - [Content-Type, text/plain; charset=UTF-8]
-          - [Vary, Accept]
-          body: |2
-             | _source[permanent].timestamp<_source[volatile].timestamp |
-            -+----------------------------------------------------------+-
-             | true                                                     |
-
-             ----
-             /{_source[permanent].timestamp<_source[volatile].timestamp}
-             SELECT ("!source_1"."timestamp" < "!source_2"."timestamp")
+        - uri: /{_source[permanent].timestamp<=_source[volatile].timestamp}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          - [Vary, Accept]
+          body: |2
+             | _source[permanent].timestamp<=_source[volatile].timestamp |
+            -+-----------------------------------------------------------+-
+             | true                                                      |
+
+             ----
+             /{_source[permanent].timestamp<=_source[volatile].timestamp}
+             SELECT ("!source_1"."timestamp" <= "!source_2"."timestamp")
              FROM (SELECT 1 AS "/") AS "!"
                   LEFT OUTER JOIN (SELECT "!source"."timestamp"
                                    FROM "!source"
             return super(QueryCase.Output, cls).__load__(mapping)
 
         def __dump__(self):
-            mapping = {}
-            mapping['uri'] = self.uri
-            mapping['status'] = self.status
-            mapping['headers'] = [list(header) for header in self.headers]
-            mapping['body'] = self.body
-            return mapping
+            return [
+                    ('uri', self.uri),
+                    ('status', self.status),
+                    ('headers', [list(header) for header in self.headers]),
+                    ('body', self.body)]
 
     def run(self):
         app = self.ctl.state.get('htsql')