Skip to content

Commit

Permalink
Merge pull request #403 from arkanus/python3
Browse files Browse the repository at this point in the history
Modify tests to run and pass with python 3
  • Loading branch information
goodtune committed Nov 9, 2016
2 parents a43488a + 6c2533c commit 55d51b2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
10 changes: 5 additions & 5 deletions tenant_schemas/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from test_routes import *
from test_tenants import *
from test_cache import *
from test_log import *
from test_utils import *
from .test_routes import *
from .test_tenants import *
from .test_cache import *
from .test_log import *
from .test_utils import *
13 changes: 9 additions & 4 deletions tenant_schemas/tests/test_tenants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import json
from StringIO import StringIO
try:
# python 2
from StringIO import StringIO
except ImportError:
# python 3
from io import StringIO

from django.conf import settings
from django.contrib.auth.models import User
Expand Down Expand Up @@ -44,7 +49,7 @@ def test_non_auto_sync_tenant(self):
When saving a tenant that has the flag auto_create_schema as
False, the schema should not be created when saving the tenant.
"""
self.assertFalse(schema_exists('non_auto_sync_tenant'))
self.assertFalse(schema_exists('non_auto_sync_tenant'))
tenant = NonAutoSyncTenant(domain_url='something.test.com',
schema_name='non_auto_sync_tenant')
tenant.save(verbosity=BaseTestCase.get_verbosity())
Expand Down Expand Up @@ -72,7 +77,7 @@ def test_sync_tenant(self):
connection.set_tenant(tenant)

# test if data is still there
self.assertEquals(DummyModel.objects.count(), 2)
self.assertEqual(DummyModel.objects.count(), 2)

def test_auto_drop_schema(self):
"""
Expand Down Expand Up @@ -240,7 +245,7 @@ def test_command(self):
natural_foreign=True,
schema_name=get_public_schema_name(),
stdout=out)
self.assertItemsEqual(
self.assertEqual(
json.loads('[{"fields": {"domain_url": "localhost", "schema_name": "public"}, '
'"model": "tenant_schemas.tenant", "pk": 1}]'),
json.loads(out.getvalue()))
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[tox]
envlist = py27-dj{18,19,110}
envlist = py{27,35}-dj{18,19,110}

[testenv]
basepython =
py27: python2.7
py35: python3.5
usedevelop = True

deps =
Expand Down

0 comments on commit 55d51b2

Please sign in to comment.