Skip to content

Commit

Permalink
add a conditiall branch for ensuring pass in python2 ut
Browse files Browse the repository at this point in the history
Signed-off-by: Fei Su <fei.su@cloud.com>
  • Loading branch information
acefei committed Feb 20, 2024
1 parent adac070 commit f42f23f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/mail-alarm
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,15 @@ def load_mail_language(mail_language):
mail_language_file = os.path.join(
mail_language_pack_path, mail_language + ".json"
)

# this conditional branch won't be executed, it's solely for the purpose of ensuring pass in python2 ut.
if sys.version_info.major == 2:
with open(mail_language_file, "r") as fileh:
return json.load(fileh, encoding="utf-8")

with open(mail_language_file, encoding="utf-8") as fileh:
return json.load(fileh)

except IOError:
log_err('Read mail language pack error:["%s"]' % (mail_language_file))
return None
Expand Down

0 comments on commit f42f23f

Please sign in to comment.