summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-09-09 12:45:53 -0700
committerVictor Sergeyev <vsergeyev@mirantis.com>2014-12-11 11:06:36 +0200
commitb1af0f59194d500f12fa591aff950d3221adf903 (patch)
tree5fe042bd858df9504c5a67e3e209f722275920a6
parented200283c17f5502a06b9081c1968c700219384a (diff)
downloadoslo-db-b1af0f59194d500f12fa591aff950d3221adf903.tar.gz
Fix python3.x scoping issues with removed 'uee' variable
In python3.x the 'uee' variable will be removed from the scope after the except block exits (if it ever is entered) so we need to use a different variable name to ensure that it will not be deleted so we can use it later. Change-Id: Ia86a2bd1a46e57eaf47704eadc991fd0c9b08661
-rw-r--r--tests/sqlalchemy/test_exc_filters.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/sqlalchemy/test_exc_filters.py b/tests/sqlalchemy/test_exc_filters.py
index 6e1dbc1..07b00dd 100644
--- a/tests/sqlalchemy/test_exc_filters.py
+++ b/tests/sqlalchemy/test_exc_filters.py
@@ -200,14 +200,17 @@ class TestFallthroughsAndNonDBAPI(TestsExceptionFilter):
# intentionally generate a UnicodeEncodeError, as its
# constructor is quite complicated and seems to be non-public
# or at least not documented anywhere.
+ uee_ref = None
try:
six.u('\u2435').encode('ascii')
except UnicodeEncodeError as uee:
- pass
+ # Python3.x added new scoping rules here (sadly)
+ # http://legacy.python.org/dev/peps/pep-3110/#semantic-changes
+ uee_ref = uee
self._run_test(
"postgresql", six.u('select \u2435'),
- uee,
+ uee_ref,
exception.DBInvalidUnicodeParameter
)