summaryrefslogtreecommitdiff
path: root/tests/dbshell
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-07-01 13:45:02 -0400
committerTim Graham <timograham@gmail.com>2015-07-01 13:45:02 -0400
commitb535eb3fcb6768b2ee2a900c3ca7217b5aecffa6 (patch)
tree83f2b7c545d1d39e3ca278c269eebc4c8c18b38f /tests/dbshell
parentb44dee16e60ff2600fee90576e5bf0083c266104 (diff)
downloaddjango-b535eb3fcb6768b2ee2a900c3ca7217b5aecffa6.tar.gz
Refs #23658 -- Fixed unclosed file in dbshell tests.
Diffstat (limited to 'tests/dbshell')
-rw-r--r--tests/dbshell/test_postgresql_psycopg2.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/dbshell/test_postgresql_psycopg2.py b/tests/dbshell/test_postgresql_psycopg2.py
index aecbba7f42..c270de3041 100644
--- a/tests/dbshell/test_postgresql_psycopg2.py
+++ b/tests/dbshell/test_postgresql_psycopg2.py
@@ -23,7 +23,8 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase):
def _mock_subprocess_call(*args):
self.subprocess_args = list(*args)
if 'PGPASSFILE' in os.environ:
- self.pgpass = open(os.environ['PGPASSFILE'], 'rb').read()
+ with open(os.environ['PGPASSFILE'], 'rb') as f:
+ self.pgpass = f.read()
else:
self.pgpass = None
return 0