From: Shane Jaroch Date: Fri, 12 Apr 2024 23:54:47 +0000 (-0400) Subject: add todo; use/compare exc string in var X-Git-Tag: v0.2.8.dev2~27 X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=b414773059b25f1c48d56d4c19cb2d1a6e0f650c;p=nutratech%2Fcli.git add todo; use/compare exc string in var --- diff --git a/ntclient/core/nutprogbar.py b/ntclient/core/nutprogbar.py index 9f30dd6..dd40c37 100644 --- a/ntclient/core/nutprogbar.py +++ b/ntclient/core/nutprogbar.py @@ -48,8 +48,9 @@ def nutrient_progress_bars( for nutrient_id, amt in analysis.items(): if nutrient_id not in nut_amts: nut_amts[int(nutrient_id)] = amt - else: - nut_amts[int(nutrient_id)] += amt + else: # pragma: no cover + # nut_amts[int(nutrient_id)] += amt + raise ValueError("Not implemented yet, need to sum up nutrient amounts") print_bars() return nut_amts diff --git a/ntclient/services/bugs.py b/ntclient/services/bugs.py index 2cec060..050d8af 100644 --- a/ntclient/services/bugs.py +++ b/ntclient/services/bugs.py @@ -14,6 +14,8 @@ from ntclient import __db_target_nt__, __db_target_usda__, __version__ from ntclient.persistence.sql.nt import sql as sql_nt from ntclient.utils import CLI_CONFIG +# TODO: handle mocks in tests so coverage doesn't vary when bugs exist (vs. don't) + def insert(args: list, exception: Exception) -> None: """Insert bug report into nt.sqlite3, return True/False.""" @@ -54,9 +56,10 @@ INSERT INTO bug ) except sqlite3.IntegrityError as exc: print(f"WARN: {repr(exc)}") - if repr(exc) == ( - "IntegrityError('UNIQUE constraint failed: " "bug.arguments, bug.stack')" - ): + dupe_bug_insertion_exc = ( + "IntegrityError('UNIQUE constraint failed: bug.arguments, bug.stack')" + ) + if repr(exc) == dupe_bug_insertion_exc: print("INFO: bug report already exists") else: raise