Skip to content

Commit 175a093

Browse files
committed
BUG19538069: Fix failing unit tests
Failing tests related to float with Python 2.6 are fixed with this patch. We also revert the use of subprocess.check_output() because it is not supported in Python v2.6.
1 parent 5b3bf77 commit 175a093

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

tests/mysqld.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def process_running(pid):
9090
"""
9191
if os.name == 'nt':
9292
# We are on Windows
93-
output = subprocess.check_output("tasklist")
93+
process = subprocess.Popen(['tasklist'], stdout=subprocess.PIPE)
94+
output, _ = process.communicate()
9495
lines = [line.split(None, 2) for line in output.splitlines() if line]
9596
for name, apid, _ in lines:
9697
name = name.decode('utf-8')

tests/test_conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_quote(self):
171171
b'NULL',
172172
b'128',
173173
b'1281288',
174-
b'3.14',
174+
repr(float(3.14)) if PY2 else b'3.14',
175175
b'3.14',
176176
b"'string A'",
177177
b"'string B'",

tests/test_cursor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def test__process_params(self):
365365
b'NULL',
366366
b'128',
367367
b'1281288',
368-
b'3.14',
368+
repr(float(3.14)) if PY2 else b'3.14',
369369
b"'3.14'",
370370
b"'back\\\\slash'",
371371
b"'newline\\n'",
@@ -425,7 +425,7 @@ def test__process_params_dict(self):
425425
b'%(a)s': b'NULL',
426426
b'%(b)s': b'128',
427427
b'%(c)s': b'1281288',
428-
b'%(d)s': b'3.14',
428+
b'%(d)s': repr(float(3.14)) if PY2 else b'3.14',
429429
b'%(e)s': b"'3.14'",
430430
b'%(f)s': b"'back\\\\slash'",
431431
b'%(g)s': b"'newline\\n'",

0 commit comments

Comments
 (0)