From 3fa24ea8f5af361f39f1fb56ec911d381b680943 Mon Sep 17 00:00:00 2001 From: Cyril Jouve Date: Thu, 7 Jun 2018 10:31:33 +0200 Subject: silence logs/warnings in unittests --- gitlab/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gitlab/cli.py') diff --git a/gitlab/cli.py b/gitlab/cli.py index 4d41b83..4870192 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -120,7 +120,8 @@ def _parse_value(v): # If the user-provided value starts with @, we try to read the file # path provided after @ as the real value. Exit on any error. try: - return open(v[1:]).read() + with open(v[1:]) as fl: + return fl.read() except Exception as e: sys.stderr.write("%s\n" % e) sys.exit(1) -- cgit v1.2.1