Exemple #1
0
from peewee import *
from peewee import AliasMap
from peewee import logger
from peewee import print_
from peewee import QueryCompiler
from peewee import SelectQuery
try:
    from unittest import mock
except ImportError:
    from playhouse.tests.libs import mock

# Register psycopg2 compatibility hooks.
try:
    from pyscopg2cffi import compat
    compat.register()
except ImportError:
    pass

# Python 2/3 compatibility.
if sys.version_info[0] < 3:
    import codecs
    ulit = lambda s: codecs.unicode_escape_decode(s)[0]
    binary_construct = buffer
    binary_types = buffer
else:
    ulit = lambda s: s
    binary_construct = lambda s: bytes(s.encode('raw_unicode_escape'))
    binary_types = (bytes, memoryview)

TEST_BACKEND = os.environ.get('PEEWEE_TEST_BACKEND') or 'sqlite'
Exemple #2
0
from peewee import *
from peewee import AliasMap
from peewee import logger
from peewee import print_
from peewee import QueryCompiler
from peewee import SelectQuery
try:
    from unittest import mock
except ImportError:
    from playhouse.tests.libs import mock


# Register psycopg2 compatibility hooks.
try:
    from pyscopg2cffi import compat
    compat.register()
except ImportError:
    pass
else:
    try:
        import psycopg2
    except ImportError:
        pass

# Python 2/3 compatibility.
if sys.version_info[0] < 3:
    import codecs
    ulit = lambda s: codecs.unicode_escape_decode(s)[0]
    binary_construct = buffer
    binary_types = buffer
else: