From 428a9ae852f0b60c26b4231b56220c5dda46120e Mon Sep 17 00:00:00 2001 From: Ajitesh Rai Date: Tue, 24 Oct 2017 00:20:20 +0530 Subject: [PATCH] Update config.py Increase code coverage. --- sendgrid/helpers/inbound/config.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sendgrid/helpers/inbound/config.py b/sendgrid/helpers/inbound/config.py index 1bd076b76..49242f54e 100644 --- a/sendgrid/helpers/inbound/config.py +++ b/sendgrid/helpers/inbound/config.py @@ -28,10 +28,14 @@ def init_environment(): os.environ.get('VAR_NAME')""" base_path = os.path.abspath(os.path.dirname(__file__)) if os.path.exists(base_path + '/.env'): - for line in open(base_path + '/.env'): - var = line.strip().split('=') - if len(var) == 2: - os.environ[var[0]] = var[1] + with open(base_path + '/.env') as f: + lines = f.readlines() + for line in lines: + var = line.strip().split('=') + if len(var) == 2: + os.environ[var[0]] = var[1] + + @property def debug_mode(self):