From 6bd8462380e1c078969867d9a0f4871fcdbe52b4 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 6 Jul 2015 16:17:56 -0400 Subject: [PATCH] Refs #23658 -- Fixed dbshell tests on Windows. --- tests/dbshell/test_postgresql_psycopg2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/dbshell/test_postgresql_psycopg2.py b/tests/dbshell/test_postgresql_psycopg2.py index c270de3041..0bb8721b70 100644 --- a/tests/dbshell/test_postgresql_psycopg2.py +++ b/tests/dbshell/test_postgresql_psycopg2.py @@ -24,7 +24,7 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase): self.subprocess_args = list(*args) if 'PGPASSFILE' in os.environ: with open(os.environ['PGPASSFILE'], 'rb') as f: - self.pgpass = f.read() + self.pgpass = f.read().strip() # ignore line endings else: self.pgpass = None return 0 @@ -44,7 +44,7 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase): 'PORT': 444, }), ( ['psql', '-U', 'someuser', '-h', 'somehost', '-p', '444', 'dbname'], - b'somehost:444:dbname:someuser:somepassword\n', + b'somehost:444:dbname:someuser:somepassword', ) ) @@ -71,7 +71,7 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase): 'PORT': 444, }), ( ['psql', '-U', 'some:user', '-h', '::1', '-p', '444', 'dbname'], - b'\\:\\:1:444:dbname:some\\:user:some\\:password\n', + b'\\:\\:1:444:dbname:some\\:user:some\\:password', ) ) @@ -85,7 +85,7 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase): 'PORT': 444, }), ( ['psql', '-U', 'some\\user', '-h', 'somehost', '-p', '444', 'dbname'], - b'somehost:444:dbname:some\\\\user:some\\\\password\n', + b'somehost:444:dbname:some\\\\user:some\\\\password', ) ) @@ -98,7 +98,7 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase): username_str = force_str(username, encoding) password_str = force_str(password, encoding) pgpass_bytes = force_bytes( - 'somehost:444:dbname:%s:%s\n' % (username, password), + 'somehost:444:dbname:%s:%s' % (username, password), encoding=encoding, ) except UnicodeEncodeError: