Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Move tests out of momoko module.
Browse files Browse the repository at this point in the history
This makes it possible to run the tests without importing
one of the Psycopg2 implementations first.
  • Loading branch information
FSX committed Jan 16, 2013
1 parent a13246b commit af1937d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
9 changes: 1 addition & 8 deletions setup.py
Expand Up @@ -21,19 +21,12 @@
dependencies = ['tornado']
psycopg2_impl = os.environ.get('MOMOKO_PSYCOPG2_IMPL', 'psycopg2')


if psycopg2_impl == 'psycopg2cffi':
print('Using psycopg2cffi')
dependencies.append('psycopg2cffi')

from psycopg2cffi import compat
compat.register()
elif psycopg2_impl == 'psycopg2ct':
print('Using psycopg2ct')
dependencies.append('psycopg2ct')

from psycopg2ct import compat
compat.register()
else:
print('Using psycopg2')
dependencies.append('psycopg2')
Expand All @@ -49,7 +42,7 @@
url='http://momoko.61924.nl/',
packages=['momoko'],
license='MIT',
test_suite='momoko.tests',
test_suite='tests',
install_requires=dependencies,
classifiers = [
'Development Status :: 4 - Beta',
Expand Down
16 changes: 14 additions & 2 deletions momoko/tests.py → tests.py
Expand Up @@ -3,8 +3,6 @@
import random
import unittest

import momoko
import psycopg2
from tornado import gen
from tornado.testing import AsyncTestCase

Expand All @@ -24,6 +22,20 @@
'MOMOKO_TEST_HOST, MOMOKO_TEST_PORT')


psycopg2_impl = os.environ.get('MOMOKO_PSYCOPG2_IMPL', 'psycopg2')

if psycopg2_impl == 'psycopg2cffi':
from psycopg2cffi import compat
compat.register()
elif psycopg2_impl == 'psycopg2ct':
from psycopg2ct import compat
compat.register()


import momoko
import psycopg2


class BaseTest(AsyncTestCase):
def __init__(self, *args, **kwargs):
self.assert_equal = self.assertEqual
Expand Down

0 comments on commit af1937d

Please sign in to comment.