Skip to content

Commit

Permalink
fix coverage & test
Browse files Browse the repository at this point in the history
  • Loading branch information
jepler committed Jul 18, 2024
1 parent ddd9a0e commit 2bd84cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions leapseconddata/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,17 @@ def table(ctx: click.Context, *, start: datetime.datetime, end: datetime.datetim
@cli.command
def sources() -> None:
"""Print information about leap-second.list data sources"""
first = False
first = True
for location in LeapSecondData.standard_file_sources + LeapSecondData.standard_network_sources:
if not first:
print()
first = False
try:
leap_second_data = LeapSecondData.from_url(location, check_hash=True)
except InvalidHashError:
except InvalidHashError: # pragma no coverage
print(f"{location}: Invalid hash")
leap_second_data = LeapSecondData.from_url(location, check_hash=False)
except Exception as e: # noqa: BLE001
except Exception as e: # pragma no coverage # noqa: BLE001
print(f"{location}: {e}")
leap_second_data = None

Expand Down
1 change: 1 addition & 0 deletions testleapseconddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def test_main(self) -> None:
self.run_main("next-leapsecond", "2100-2-2")
self.run_main("previous-leapsecond", "2009-2-2")
self.run_main("previous-leapsecond", "1960-2-2")
self.run_main("sources")

def test_corrupt(self) -> None:
self.assertRaises(
Expand Down

0 comments on commit 2bd84cc

Please sign in to comment.