Skip to content

Commit

Permalink
Added a regression test for r14781. Also fixed a bug where connection…
Browse files Browse the repository at this point in the history
….vendor was effectively always 'unknown', causing all vendor-specific tests to be skipped.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14783 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
nightflyerkilo committed Dec 3, 2010
1 parent cbf9d6e commit 5475da1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/db/backends/__init__.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class BaseDatabaseWrapper(local):
Represents a database connection. Represents a database connection.
""" """
ops = None ops = None
vendor = 'unknown'


def __init__(self, settings_dict, alias=DEFAULT_DB_ALIAS): def __init__(self, settings_dict, alias=DEFAULT_DB_ALIAS):
# `settings_dict` should be a dictionary containing keys such as # `settings_dict` should be a dictionary containing keys such as
Expand All @@ -20,7 +21,6 @@ def __init__(self, settings_dict, alias=DEFAULT_DB_ALIAS):
self.queries = [] self.queries = []
self.settings_dict = settings_dict self.settings_dict = settings_dict
self.alias = alias self.alias = alias
self.vendor = 'unknown'
self.use_debug_cursor = None self.use_debug_cursor = None


def __eq__(self, other): def __eq__(self, other):
Expand Down
9 changes: 9 additions & 0 deletions tests/regressiontests/backends/tests.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ def test_long_string(self):
self.assertEqual(long_str, row[0].read()) self.assertEqual(long_str, row[0].read())
c.execute('DROP TABLE ltext') c.execute('DROP TABLE ltext')


@unittest.skipUnless(connection.vendor == 'oracle',
"No need to check Oracle connection semantics")
def test_client_encoding(self):
# If the backend is Oracle, test that the client encoding is set
# correctly. This was broken under Cygwin prior to r14781.
c = connection.cursor() # Ensure the connection is initialized.
self.assertEqual(connection.connection.encoding, "UTF-8")
self.assertEqual(connection.connection.nencoding, "UTF-8")

class DateQuotingTest(TestCase): class DateQuotingTest(TestCase):


def test_django_date_trunc(self): def test_django_date_trunc(self):
Expand Down

0 comments on commit 5475da1

Please sign in to comment.