From e88f4d2e5e65ddb1de0960911ebbe7177ecfc038 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 29 Jul 2018 13:30:36 +0000 Subject: [PATCH] AgePolicy: Explicitly ignore comment lines in data files Currently not useful, but it enables us to write comment lines in the test data files. Signed-off-by: Niels Thykier --- britney2/policies/policy.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/britney2/policies/policy.py b/britney2/policies/policy.py index e05da08..a2ebc22 100644 --- a/britney2/policies/policy.py +++ b/britney2/policies/policy.py @@ -312,7 +312,10 @@ class AgePolicy(BasePolicy): try: with open(filename, encoding='utf-8') as fd: for line in fd: - # + if line.startswith('#'): + # Ignore comment lines (mostly used for tests) + continue + # ) l = line.split() if len(l) != 3: continue @@ -344,6 +347,9 @@ class AgePolicy(BasePolicy): with open(filename, errors='surrogateescape', encoding='ascii') as fd: for line in fd: + if line.startswith('#'): + # Ignore comment lines (mostly used for tests) + continue # l = line.split() if len(l) != 3: