montior: remove "unit" from Progress (YAGNI)

Removing "unit" from progress as it is currently unused and we
can always add it back when we have a real use-case.
This commit is contained in:
Michael Vogt 2023-11-22 10:41:55 +01:00 committed by Ondřej Budai
parent f6125048c6
commit de9ead53a2
2 changed files with 2 additions and 4 deletions

View file

@ -113,10 +113,9 @@ class Context:
class Progress:
def __init__(self, name: str, total: int, unit: Optional[str] = None):
def __init__(self, name: str, total: int):
self.name = name
self.total = total
self.unit = unit
self.done = None
self._sub_progress: Optional[Progress] = None
@ -144,7 +143,6 @@ class Progress:
"name": self.name,
"total": self.total,
"done": self.done,
"unit": self.unit,
}
if self._sub_progress:
d["progress"] = self._sub_progress.as_dict()

View file

@ -159,7 +159,7 @@ def test_context():
def test_progress():
prog = Progress("test", total=12, unit="tests")
prog = Progress("test", total=12)
subprog = Progress("test-sub1", total=3)
prog.sub_progress(subprog)
assert prog.done is None # starts with None until the first incr()