Skip to content

Commit

Permalink
debug logging in gcn parser test, exclude 'except KeyError' from cove…
Browse files Browse the repository at this point in the history
…rage
  • Loading branch information
simeonreusch committed Dec 5, 2021
1 parent a392cbe commit ffbfb6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exclude_lines =
raise AssertionError
raise NotImplementedError
raise KeyError
except KeyError
raise ValueError
except JSONDecodeError:
if response.headers:
Expand Down
10 changes: 3 additions & 7 deletions tests/test_gcn_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

from nuztf.parse_nu_gcn import get_latest_gcn, gcn_url, find_gcn_no, ParsingError

# from ampel.log.AmpelLogger import AmpelLogger

# logger = AmpelLogger()


class TestNeutrinoScanner(unittest.TestCase):

Expand All @@ -20,7 +16,7 @@ def setUp(self):

def test_latest(self):
self.logger.info("\n\n Testing parsing of GCNs \n\n")
no = get_latest_gcn()
no = get_latest_gcn(logger=self.logger)
self.logger.info(f"Latest alert is {no}")
url = gcn_url(gcn_number=no)
self.logger.info(f"URL is {url}")
Expand All @@ -29,7 +25,7 @@ def test_named(self):

name = "IC200620A"

num = int(find_gcn_no(name))
num = int(find_gcn_no(base_nu_name=name, logger=self.logger))

ref = 27997

Expand All @@ -43,7 +39,7 @@ def test_named(self):
self.logger.info(f"Searching for fictional alert {fakename}")

try:
no = find_gcn_no(fakename)
no = find_gcn_no(base_nu_name=fakename, logger=self.logger)
raise Exception(
f"Somehow found a GCN ({no}) matching "
f"fictional neutrino alert {fakename}"
Expand Down

0 comments on commit ffbfb6b

Please sign in to comment.