diff --git a/.gitignore b/.gitignore index 77d9edc..3ed1302 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +build __pycache__ .idea .pytest_cache diff --git a/cadump/cadump.py b/cadump/cadump.py index 6f0de0e..6d54b27 100644 --- a/cadump/cadump.py +++ b/cadump/cadump.py @@ -8,6 +8,7 @@ import dateutil.parser import pytz import datetime import time +import re import logging logger = logging.getLogger("logger") @@ -78,6 +79,7 @@ def read_channels(filename): channels = [] for line in lines: + line = re.sub(r'\w*#.*', "", line) line = line.strip() if line: # if not empty line channels.append(line) # remove all leading and trailing spaces diff --git a/tests/channels.txt b/tests/channels.txt index 7033f9e..63868d2 100644 --- a/tests/channels.txt +++ b/tests/channels.txt @@ -2,4 +2,5 @@ S10-CPCL-VM1MGC:LOAD ONE TWO -THREE +# Comment that need to be removed +THREE # one more comment at the end that need to be removed diff --git a/tests/test_download_data.py b/tests/test_download_data.py index e5e30e1..b85e1a0 100644 --- a/tests/test_download_data.py +++ b/tests/test_download_data.py @@ -27,9 +27,7 @@ class TestDownloadData(TestCase): def test_read_channels(self): channels = cadump.read_channels("channels.txt") logging.info(channels) - self.assertEqual(len(channels), 3) - - + self.assertEqual(len(channels), 4) if __name__ == '__main__':