switch to having full_name/identifier instead of identifier/output_markdown_file
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 24 Sep 2021 18:54:37 +0000 (11:54 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Fri, 24 Sep 2021 18:54:37 +0000 (11:54 -0700)
budget-sync-config.toml
src/budget_sync/config.py
src/budget_sync/test/test_budget_graph.py
src/budget_sync/test/test_config.py
src/budget_sync/test/test_write_budget_csv.py
src/budget_sync/test/test_write_budget_markdown.py
src/budget_sync/write_budget_markdown.py

index 3f3c0b7905208e939ec5941db30c6109d63e96bd..9d517ae9f7925797df4439d95c1939fa086fea98 100644 (file)
@@ -1,86 +1,86 @@
 bugzilla_url = "https://bugs.libre-soc.org"
 
-[people."Jacob R. Lifshay"]
+[people."programmerjake"]
 email = "programmerjake@gmail.com"
-aliases = ["programmerjake", "jacob", "Jacob", "Jacob Lifshay"]
-output_markdown_file = "programmerjake.mdwn"
+aliases = ["jacob", "Jacob", "Jacob Lifshay"]
+full_name = "Jacob R. Lifshay"
 
-[people."Luke Kenneth Casson Leighton"]
+[people."lkcl"]
 email = "lkcl@lkcl.net"
-aliases = ["lkcl", "donated", "luke", "Luke", "Luke Leighton"]
-output_markdown_file = "lkcl.mdwn"
+aliases = ["donated", "luke", "Luke", "Luke Leighton"]
+full_name = "Luke Kenneth Casson Leighton"
 
-[people."NLnet 2019-10P"]
+[people."NLnet_2019_10P"]
 email = "2019-10P@nlnet.nl"
 aliases = []
-output_markdown_file = "NLnet_2019_10P.mdwn"
+full_name = "NLnet 2019-10P"
 
-[people."Mikolaj"]
+[people."mikolaj"]
 email = "wielgusmikolaj@gmail.com"
-aliases = ["mikolaj", "mikolajw"]
-output_markdown_file = "mikolaj.mdwn"
+aliases = ["mikolajw"]
+full_name = "Mikolaj"
 
-[people."Rudi (ASICs.ws)"]
+[people."asics_ws"]
 email = "rudi@asics.ws"
 aliases = ["rudi"]
-output_markdown_file = "asics_ws.mdwn"
+full_name = "Rudi (ASICs.ws)"
 
-[people."Dmitry (3mdeb)"]
+[people."3mdeb_dmitry"]
 email = "dmitry.selyutin@3mdeb.com"
 aliases = ["dmitry", "dmitry_3mdeb"]
-output_markdown_file = "3mdeb_dmitry.mdwn"
+full_name = "Dmitry (3mdeb)"
 
-[people."Maciej (3mdeb)"]
+[people."3mdeb_maciej"]
 email = "maciej.pijanowski@3mdeb.com"
 aliases = ["maciej", "maciej_3mdeb"]
-output_markdown_file = "3mdeb_maciej.mdwn"
+full_name = "Maciej (3mdeb)"
 
-[people."Alexandre Oliva"]
+[people."lxo"]
 email = "oliva@libre-soc.org"
-aliases = ["lxo", "oliva", "aoliva"]
-output_markdown_file = "lxo.mdwn"
+aliases = ["oliva", "aoliva"]
+full_name = "Alexandre Oliva"
 
-[people."Andrew Wygle"]
+[people."awygle"]
 email = "awygle@gmail.com"
-aliases = ["awygle", "mail@awygle.com"]
-output_markdown_file = "awygle.mdwn"
+aliases = ["mail@awygle.com"]
+full_name = "Andrew Wygle"
 
-[people."Samuel A. Falvo II"]
+[people."Samuel_A_Falvo_II"]
 email = "kc5tja@arrl.net"
 aliases = ["kc5tja", "samuel", "Samuel", "Samuel Falvo II", "sam.falvo"]
-output_markdown_file = "Samuel_A_Falvo_II.mdwn"
+full_name = "Samuel A. Falvo II"
 
-[people."Vivek Pandya"]
+[people."vivek_pandya"]
 email = "vivekvpandya@gmail.com"
 aliases = ["vivekvpandya", "vivek pandya", "vivek", "Vivek"]
-output_markdown_file = "vivek_pandya.mdwn"
+full_name = "Vivek Pandya"
 
-[people."Florent Kermarrec"]
+[people."florent_kermarrec"]
 email = "florent@enjoy-digital.fr"
 aliases = ["florent", "Florent"]
-output_markdown_file = "florent_kermarrec.mdwn"
+full_name = "Florent Kermarrec"
 
-[people."Michael Nolan"]
+[people."michael_nolan"]
 email = "mtnolan2640@gmail.com"
 aliases = ["mnolan", "michael", "Michael", "mtnolan", "mtnolan2640"]
-output_markdown_file = "michael_nolan.mdwn"
+full_name = "Michael Nolan"
 
-[people."Alain D D Williams"]
+[people."addw"]
 email = "addw@phcomp.co.uk"
-aliases = ["addw", "Alain", "Alain Williams", "alain"]
-output_markdown_file = "addw.mdwn"
+aliases = ["Alain", "Alain Williams", "alain"]
+full_name = "Alain D D Williams"
 
-[people."Jock Tanner"]
+[people."jock_tanner"]
 email = "tanner.of.kha@gmail.com"
 aliases = ["jock"]
-output_markdown_file = "jock_tanner.mdwn"
+full_name = "Jock Tanner"
 
-[people."R Veera Kumar"]
+[people."veera"]
 email = "vklr@vkten.in"
-aliases = ["vklr", "veera", "Veera Kumar", "Veera"]
-output_markdown_file = "veera.mdwn"
+aliases = ["vklr", "Veera Kumar", "Veera"]
+full_name = "R Veera Kumar"
 
-[people."Jean-Paul Chaput"]
+[people."jean-paul_chaput"]
 email = "Jean-Paul.Chaput@lip6.fr"
 aliases = [
     "lip6",
@@ -90,72 +90,72 @@ aliases = [
     "jean-paul",
     "jean paul",
 ]
-output_markdown_file = "jean-paul_chaput.mdwn"
+full_name = "Jean-Paul Chaput"
 
-[people."Staf Verhaegen"]
+[people."staf_verhaegen"]
 email = "staf@fibraservi.eu"
 aliases = ["staf", "Staf", "chips4makers"]
-output_markdown_file = "staf_verhaegen.mdwn"
+full_name = "Staf Verhaegen"
 
-[people."Lauri Kasanen"]
+[people."lauri_kasanen"]
 email = "cand@gmx.com"
 aliases = ["lauri", "Lauri"]
-output_markdown_file = "lauri_kasanen.mdwn"
+full_name = "Lauri Kasanen"
 
-[people."Yehowshua Immanuel"]
+[people."yehowshua_immanuel"]
 email = "yimmanuel3@gatech.edu"
 aliases = ["yehowshua", "Yehowshua"]
-output_markdown_file = "yehowshua_immanuel.mdwn"
+full_name = "Yehowshua Immanuel"
 
 [people."whitequark"]
 email = "whitequark@whitequark.org"
 aliases = []
-output_markdown_file = "whitequark.mdwn"
+full_name = "whitequark"
 
-[people."Tobias Platen"]
+[people."tplaten"]
 email = "libre-soc@platen-software.de"
-aliases = ["tobias", "Tobias", "tplaten"]
-output_markdown_file = "tplaten.mdwn"
+aliases = ["tobias", "Tobias"]
+full_name = "Tobias Platen"
 
-[people."Cole Poirier"]
+[people."cole"]
 email = "colepoirier@gmail.com"
-aliases = ["cole", "Cole", "colepoirier"]
-output_markdown_file = "cole.mdwn"
+aliases = ["Cole", "colepoirier"]
+full_name = "Cole Poirier"
 
-[people."Aleksandar Kostovic"]
+[people."aleksandar_kostovic"]
 email = "alexandar.kostovic@gmail.com"
 aliases = ["alexandar", "aleksandar"]
-output_markdown_file = "aleksandar_kostovic.mdwn"
+full_name = "Aleksandar Kostovic"
 
-[people."Cesar Strauss"]
+[people."cesar_strauss"]
 email = "cestrauss@gmail.com"
 aliases = ["cesar", "Cesar", "cestrauss"]
-output_markdown_file = "cesar_strauss.mdwn"
+full_name = "Cesar Strauss"
 
-[people."Dimitri Galayko"]
+[people."dimitri_galayko"]
 email = "dimitri.galayko@lip6.fr"
 aliases = ["dimitri"]
-output_markdown_file = "dimitri_galayko.mdwn"
+full_name = "Dimitri Galayko"
 
-[people."Justin Moore"]
+[people."drchat"]
 email = "me@justinm.one"
 aliases = ["DrChat"]
-output_markdown_file = "drchat.mdwn"
+full_name = "Justin Moore"
 
-[people."Richard Wilbur"]
+[people."rwilbur"]
 email = "richard.wilbur@gmail.com"
-aliases = ["rwilbur"]
-output_markdown_file = "rwilbur.mdwn"
+aliases = []
+full_name = "Richard Wilbur"
 
-[people."Hendrik Boom"]
+[people."hendrik"]
 email = "hendrik@topoi.pooq.com"
-aliases = ["hendrik"]
-output_markdown_file = "hendrik.mdwn"
+aliases = []
+full_name = "Hendrik Boom"
 
-[people."Kyle Lehman"]
+[people."klehman"]
 email = "klehman9@comcast.net"
-aliases = ["klehman"]
-output_markdown_file = "klehman.mdwn"
+aliases = []
+full_name = "Kyle Lehman"
 
 [milestones]
 "NLnet.2019.02" = { canonical_bug_id = 191 }
index 16084445b398835550362888fb687984ac3a6910..af7db98f4694a959dc88e742b0fe4a27e8b0d322 100644 (file)
@@ -15,27 +15,32 @@ class Person:
     email: Optional[str]
 
     def __init__(self, config: "Config", identifier: str,
-                 output_markdown_file: str,
+                 full_name: str,
                  aliases: Optional[OrderedSet[str]] = None,
                  email: Optional[str] = None):
         self.config = config
         self.identifier = identifier
-        self.output_markdown_file = output_markdown_file
         if aliases is None:
             aliases = OrderedSet()
         else:
             assert isinstance(aliases, OrderedSet)
         self.aliases = aliases
         self.email = email
+        self.full_name = full_name
 
     @cached_property
     def all_names(self) -> OrderedSet[str]:
         retval = OrderedSet(self.aliases)
         retval.add(self.identifier)
+        retval.add(self.full_name)
         if self.email is not None:
             retval.add(self.email)
         return retval
 
+    @cached_property
+    def output_markdown_file(self) -> str:
+        return self.identifier + '.mdwn'
+
     def __eq__(self, other):
         return self.identifier == other.identifier
 
@@ -49,7 +54,7 @@ class Person:
 
     def __repr__(self):
         return (f"Person(config=..., identifier={self.identifier!r}, "
-                f"output_markdown_file={self.output_markdown_file!r}, "
+                f"full_name={self.full_name!r}, "
                 f"aliases={self.aliases!r}, email={self.email!r})")
 
 
@@ -98,21 +103,27 @@ class Config:
             for name in person.all_names:
                 other_person = retval.get(name)
                 if other_person is not None and other_person is not person:
-                    alias_or_email = "alias"
+                    alias_or_email_or_full_name = "alias"
                     if name == person.email:
-                        alias_or_email = "email"
+                        alias_or_email_or_full_name = "email"
+                    if name == person.full_name:
+                        alias_or_email_or_full_name = "full_name"
                     if name in self.people:
                         raise ConfigParseError(
-                            f"{alias_or_email} is not allowed to be the same "
+                            f"{alias_or_email_or_full_name} is not allowed "
+                            f"to be the same "
                             f"as any person's identifier: in person entry for "
                             f"{person.identifier!r}: {name!r} is also the "
                             f"identifier for person"
                             f" {other_person.identifier!r}")
                     raise ConfigParseError(
-                        f"{alias_or_email} is not allowed to be the same as "
-                        f"another person's alias or email: in person entry "
+                        f"{alias_or_email_or_full_name} is not allowed "
+                        f"to be the same as "
+                        f"another person's alias, email, or full_name: "
+                        f"in person entry "
                         f"for {person.identifier!r}: {name!r} is also an alias"
-                        f" or email for person {other_person.identifier!r}")
+                        f", email, or full_name for person "
+                        f"{other_person.identifier!r}")
                 retval[name] = person
         return retval
 
@@ -145,7 +156,7 @@ class Config:
                 f"person entry for {identifier!r} must be a table")
         aliases = OrderedSet()
         email = None
-        output_markdown_file = None
+        full_name = None
         for k, v in value.items():
             assert isinstance(k, str)
             if k == "aliases":
@@ -166,20 +177,20 @@ class Config:
                         f"`email` field in person entry for {identifier!r} "
                         f"must be a string")
                 email = v
-            elif k == "output_markdown_file":
+            elif k == "full_name":
                 if not isinstance(v, str):
                     raise ConfigParseError(
-                        f"`output_markdown_file` field in person entry for "
+                        f"`full_name` field in person entry for "
                         f"{identifier!r} must be a string")
-                output_markdown_file = v
+                full_name = v
             else:
                 raise ConfigParseError(
                     f"unknown field in person entry for {identifier!r}: `{k}`")
-        if output_markdown_file is None:
-            raise ConfigParseError(f"`output_markdown_file` field is missing in "
+        if full_name is None:
+            raise ConfigParseError(f"`full_name` field is missing in "
                                    f"person entry for {identifier!r}")
         return Person(config=self, identifier=identifier,
-                      output_markdown_file=output_markdown_file,
+                      full_name=full_name,
                       aliases=aliases, email=email)
 
     def _parse_people(self, people: Any):
index 6675448b3effeaf84246c52fa13a3c18bab1c355..bd3a9cb0658765a72ab7943ac524348a37e0e45c 100644 (file)
@@ -143,14 +143,14 @@ EXAMPLE_CONFIG = Config.from_str(
     bugzilla_url = "https://bugzilla.example.com/"
     [people."person1"]
     aliases = ["person1_alias1", "alias1"]
-    output_markdown_file = "person1.mdwn"
+    full_name = "Person One"
     [people."person2"]
     email = "person2@example.com"
     aliases = ["person1_alias2", "alias2", "person 2"]
-    output_markdown_file = "person2.mdwn"
+    full_name = "Person Two"
     [people."person3"]
     email = "user@example.com"
-    output_markdown_file = "person3.mdwn"
+    full_name = "Person Three"
     [milestones]
     "milestone 1" = { canonical_bug_id = 1 }
     "milestone 2" = { canonical_bug_id = 2 }
@@ -199,13 +199,13 @@ class TestBudgetGraph(unittest.TestCase):
             "status=BugStatus.CONFIRMED, assignee=Person<'person3'>, "
             "resolved_payments={}, payment_summaries={})], roots=[#1], "
             "assigned_nodes={Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(['person1_alias1', 'alias1']), email=None): "
             "[], Person(config=..., identifier='person2', "
-            "output_markdown_file='person2.mdwn', "
+            "full_name='Person Two', "
             "aliases=OrderedSet(['person1_alias2', 'alias2', 'person 2']), "
             "email='person2@example.com'): [], Person(config=..., "
-            "identifier='person3', output_markdown_file='person3.mdwn', "
+            "identifier='person3', full_name='Person Three', "
             "aliases=OrderedSet(), email='user@example.com'): [#1, #2]}, "
             "assigned_nodes_for_milestones={Milestone(config=..., "
             "identifier='milestone 1', canonical_bug_id=1): [#1, #2], "
@@ -215,19 +215,19 @@ class TestBudgetGraph(unittest.TestCase):
             "1', canonical_bug_id=1): [], Milestone(config=..., "
             "identifier='milestone 2', canonical_bug_id=2): []}, "
             "payments={Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(['person1_alias1', 'alias1']), email=None): "
             "{Milestone(config=..., identifier='milestone 1', "
             "canonical_bug_id=1): [], Milestone(config=..., "
             "identifier='milestone 2', canonical_bug_id=2): []}, "
             "Person(config=..., identifier='person2', "
-            "output_markdown_file='person2.mdwn', "
+            "full_name='Person Two', "
             "aliases=OrderedSet(['person1_alias2', 'alias2', 'person 2']), "
             "email='person2@example.com'): {Milestone(config=..., "
             "identifier='milestone 1', canonical_bug_id=1): [], "
             "Milestone(config=..., identifier='milestone 2', "
             "canonical_bug_id=2): []}, Person(config=..., "
-            "identifier='person3', output_markdown_file='person3.mdwn', "
+            "identifier='person3', full_name='Person Three', "
             "aliases=OrderedSet(), email='user@example.com'): "
             "{Milestone(config=..., identifier='milestone 1', "
             "canonical_bug_id=1): [], Milestone(config=..., "
@@ -256,20 +256,20 @@ class TestBudgetGraph(unittest.TestCase):
             "identifier='milestone 1', canonical_bug_id=1): [], "
             "Milestone(config=..., identifier='milestone 2', "
             "canonical_bug_id=2): []}, payments={Person(config=..., "
-            "identifier='person1', output_markdown_file='person1.mdwn', "
+            "identifier='person1', full_name='Person One', "
             "aliases=OrderedSet(['person1_alias1', 'alias1']), email=None): "
             "{Milestone(config=..., identifier='milestone 1', "
             "canonical_bug_id=1): [], Milestone(config=..., "
             "identifier='milestone 2', canonical_bug_id=2): []}, "
             "Person(config=..., identifier='person2', "
-            "output_markdown_file='person2.mdwn', "
+            "full_name='Person Two', "
             "aliases=OrderedSet(['person1_alias2', 'alias2', "
             "'person 2']), email='person2@example.com'): "
             "{Milestone(config=..., identifier='milestone 1', "
             "canonical_bug_id=1): [], Milestone(config=..., "
             "identifier='milestone 2', canonical_bug_id=2): []}, "
             "Person(config=..., identifier='person3', "
-            "output_markdown_file='person3.mdwn', aliases=OrderedSet(), "
+            "full_name='Person Three', aliases=OrderedSet(), "
             "email='user@example.com'): {Milestone(config=..., "
             "identifier='milestone 1', canonical_bug_id=1): [], "
             "Milestone(config=..., identifier='milestone 2', "
@@ -304,14 +304,14 @@ alias2 = {paid=2020-03-16,amount=23}
             "state=Paid, paid=2020-03-16, submitted=None)], status=<unknown "
             "status: 'blah'>, assignee=<unknown assignee: "
             "'unknown@example.com'>, resolved_payments={Person(config=..., "
-            "identifier='person1', output_markdown_file='person1.mdwn', "
+            "identifier='person1', full_name='Person One', "
             "aliases=OrderedSet(['person1_alias1', 'alias1']), email=None): "
             "[Payment(node=#1, payee=Person<'person1'>, payee_key='person1', "
             "amount=5, state=Paid, paid=2020-03-15, submitted=None), "
             "Payment(node=#1, payee=Person<'person1'>, payee_key='alias1', "
             "amount=10, state=Paid, paid=2020-03-15, submitted=None)], "
             "Person(config=..., identifier='person2', "
-            "output_markdown_file='person2.mdwn', "
+            "full_name='Person Two', "
             "aliases=OrderedSet(['person1_alias2', 'alias2', 'person 2']), "
             "email='person2@example.com'): [Payment(node=#1, "
             "payee=Person<'person2'>, payee_key='person2', amount=15, "
@@ -319,7 +319,7 @@ alias2 = {paid=2020-03-16,amount=23}
             "Payment(node=#1, payee=Person<'person2'>, payee_key='alias2', "
             "amount=23, state=Paid, paid=2020-03-16, submitted=None)]}, "
             "payment_summaries={Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(['person1_alias1', 'alias1']), email=None): "
             "PaymentSummary(total=15, total_paid=15, total_submitted=15, "
             "submitted_date=None, paid_date=2020-03-15, "
@@ -329,7 +329,7 @@ alias2 = {paid=2020-03-16,amount=23}
             "payee=Person<'person1'>, payee_key='alias1', amount=10, "
             "state=Paid, paid=2020-03-15, submitted=None))), "
             "Person(config=..., identifier='person2', "
-            "output_markdown_file='person2.mdwn', "
+            "full_name='Person Two', "
             "aliases=OrderedSet(['person1_alias2', 'alias2', 'person 2']), "
             "email='person2@example.com'): PaymentSummary(total=38, "
             "total_paid=23, total_submitted=38, submitted_date=None, "
@@ -348,19 +348,19 @@ alias2 = {paid=2020-03-16,amount=23}
             "1', canonical_bug_id=1): [], Milestone(config=..., "
             "identifier='milestone 2', canonical_bug_id=2): []}, "
             "payments={Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(['person1_alias1', 'alias1']), email=None): "
             "{Milestone(config=..., identifier='milestone 1', "
             "canonical_bug_id=1): [], Milestone(config=..., "
             "identifier='milestone 2', canonical_bug_id=2): []}, "
             "Person(config=..., identifier='person2', "
-            "output_markdown_file='person2.mdwn', "
+            "full_name='Person Two', "
             "aliases=OrderedSet(['person1_alias2', 'alias2', 'person 2']), "
             "email='person2@example.com'): {Milestone(config=..., "
             "identifier='milestone 1', canonical_bug_id=1): [], "
             "Milestone(config=..., identifier='milestone 2', "
             "canonical_bug_id=2): []}, Person(config=..., "
-            "identifier='person3', output_markdown_file='person3.mdwn', "
+            "identifier='person3', full_name='Person Three', "
             "aliases=OrderedSet(), email='user@example.com'): "
             "{Milestone(config=..., identifier='milestone 1', "
             "canonical_bug_id=1): [], Milestone(config=..., "
@@ -1329,7 +1329,7 @@ alias2 = {paid=2020-03-16,amount=23}
         self.assertEqual(
             repr(node1.payment_summaries),
             "{Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(['person1_alias1', 'alias1']), email=None): "
             "PaymentSummary(total=10, total_paid=0, total_submitted=0, "
             "submitted_date=None, paid_date=None, "
index 39639cb3f79a653d9b280427349c76d20fd3c1ee..d963b94c5bccdc9212e0dec4126431daedb98aaf 100644 (file)
@@ -85,15 +85,15 @@ class TestConfig(unittest.TestCase):
             bugzilla_url = ""
             [people."person1"]
             """,
-            "`output_markdown_file` field is missing in person entry for "
+            "`full_name` field is missing in person entry for "
             "'person1'")
         check_error(
             """
             bugzilla_url = ""
             [people."person1"]
-            output_markdown_file = 1
+            full_name = 1
             """,
-            "`output_markdown_file` field in person entry for 'person1' must "
+            "`full_name` field in person entry for 'person1' must "
             "be a string")
         check(
             """
@@ -101,24 +101,24 @@ class TestConfig(unittest.TestCase):
             [milestones]
             [people."person1"]
             aliases = ["a"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             [people."person2"]
             aliases = ["b"]
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             """,
             "Config(bugzilla_url='', people={"
             "'person1': Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(['a']), email=None), "
             "'person2': Person(config=..., identifier='person2', "
-            "output_markdown_file='person2.mdwn', "
+            "full_name='Person Two', "
             "aliases=OrderedSet(['b']), email=None)}, milestones={})")
         check_error(
             """
             bugzilla_url = ""
             [people."person1"]
             email = 123
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             """,
             "`email` field in person entry for 'person1' must be a string")
         check(
@@ -134,11 +134,11 @@ class TestConfig(unittest.TestCase):
             [milestones]
             [people."person1"]
             email = "email@example.com"
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             """,
             "Config(bugzilla_url='', people={"
             "'person1': Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(), email='email@example.com')}, "
             "milestones={})")
         check_error(
@@ -146,7 +146,7 @@ class TestConfig(unittest.TestCase):
             bugzilla_url = ""
             [people."person1"]
             blah = 123
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             """,
             "unknown field in person entry for 'person1': `blah`")
         check_error(
@@ -154,10 +154,10 @@ class TestConfig(unittest.TestCase):
             bugzilla_url = ""
             [milestones]
             [people."person1"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             [people."person2"]
             aliases = ["person1"]
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             """,
             "alias is not allowed to be the same as any person's identifier: "
             "in person entry for 'person2': 'person1' is also the identifier "
@@ -167,43 +167,57 @@ class TestConfig(unittest.TestCase):
             bugzilla_url = ""
             [milestones]
             [people."person1"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             aliases = ["a"]
             [people."person2"]
             aliases = ["a"]
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             """,
-            "alias is not allowed to be the same as another person's alias or "
-            "email: in person entry for 'person2': 'a' is also an alias or "
-            "email for person 'person1'")
+            "alias is not allowed to be the same as another person's alias, "
+            "email, or full_name: in person entry for 'person2': 'a' is also an alias, "
+            "email, or full_name for person 'person1'")
         check_error(
             """
             bugzilla_url = ""
             [milestones]
             [people."person1"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             aliases = ["abc@example.com"]
             [people."person2"]
             email = "abc@example.com"
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             """,
-            "email is not allowed to be the same as another person's alias or "
-            "email: in person entry for 'person2': 'abc@example.com' is also "
-            "an alias or email for person 'person1'")
+            "email is not allowed to be the same as another person's alias, "
+            "email, or full_name: in person entry for 'person2': 'abc@example.com' is also "
+            "an alias, email, or full_name for person 'person1'")
+        check_error(
+            """
+            bugzilla_url = ""
+            [milestones]
+            [people."person1"]
+            full_name = "Person One"
+            aliases = ["Person Two"]
+            [people."person2"]
+            email = "abc@example.com"
+            full_name = "Person Two"
+            """,
+            "full_name is not allowed to be the same as another person's alias, "
+            "email, or full_name: in person entry for 'person2': 'Person Two' is also "
+            "an alias, email, or full_name for person 'person1'")
         check_error(
             """
             bugzilla_url = ""
             [milestones]
             [people."person2"]
             email = "abc@example.com"
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             [people."person1"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             aliases = ["abc@example.com"]
             """,
-            "alias is not allowed to be the same as another person's alias or "
-            "email: in person entry for 'person1': 'abc@example.com' is also "
-            "an alias or email for person 'person2'")
+            "alias is not allowed to be the same as another person's alias, "
+            "email, or full_name: in person entry for 'person1': 'abc@example.com' is also "
+            "an alias, email, or full_name for person 'person2'")
         check_error(
             """
             bugzilla_url = ""
@@ -263,19 +277,21 @@ class TestConfig(unittest.TestCase):
             [milestones]
             [people."person1"]
             aliases = ["person1_alias1", "alias1"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             [people."person2"]
             aliases = ["person2_alias2", "alias2"]
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             """)
         person1 = config.people['person1']
         person2 = config.people['person2']
         self.assertEqual(config.all_names,
                          {
                              'person1': person1,
+                             'Person One': person1,
                              'person1_alias1': person1,
                              'alias1': person1,
                              'person2': person2,
+                             'Person Two': person2,
                              'person2_alias2': person2,
                              'alias2': person2,
                          })
@@ -346,13 +362,13 @@ class TestConfig(unittest.TestCase):
             [people."person1"]
             email = "person1@example.com"
             aliases = ["alias1"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             [milestones]
             "Milestone 1" = { canonical_bug_id = 123 }
             """)),
             "Config(bugzilla_url='https://bugzilla.example.com/', "
             "people={'person1': Person(config=..., identifier='person1', "
-            "output_markdown_file='person1.mdwn', "
+            "full_name='Person One', "
             "aliases=OrderedSet(['alias1']), email='person1@example.com')}, "
             "milestones={'Milestone 1': Milestone(config=..., "
             "identifier='Milestone 1', canonical_bug_id=123)})")
index 2a1bb41cf346d6f4c825c0922b743a8a7aeae457..b412f08ede70f4f7f31bd51425bb610f69c59191 100644 (file)
@@ -17,14 +17,14 @@ class TestWriteBudgetMarkdown(unittest.TestCase):
             bugzilla_url = "https://bugzilla.example.com/"
             [people."person1"]
             aliases = ["person1_alias1", "alias1"]
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             [people."person2"]
             email = "person2@example.com"
             aliases = ["person1_alias2", "alias2", "person 2"]
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             [people."person3"]
             email = "user@example.com"
-            output_markdown_file = "person3.mdwn"
+            full_name = "Person Three"
             [milestones]
             "milestone 1" = { canonical_bug_id = 1 }
             "milestone 2" = { canonical_bug_id = 2 }
index 13b4716860e62821153aaf6f0bd6d794292cb4f5..c6dba2f8b8e7f1a441cbaf58461fb228e70114fe 100644 (file)
@@ -27,9 +27,9 @@ class TestWriteBudgetMarkdown(unittest.TestCase):
             [milestones]
             [people."person1"]
             email = "person1@example.com"
-            output_markdown_file = "person1.mdwn"
+            full_name = "Person One"
             [people."person2"]
-            output_markdown_file = "person2.mdwn"
+            full_name = "Person Two"
             """)
         budget_graph = BudgetGraph([
             MockBug(bug_id=1,
@@ -49,9 +49,11 @@ class TestWriteBudgetMarkdown(unittest.TestCase):
                 "/": DIR,
                 "/output_dir": DIR,
                 '/output_dir/person1.mdwn': b'<!-- autogenerated by '
-                b'budget-sync -->\n\n# person1\n\n\n\n# Status Tracking\n\n',
+                b'budget-sync -->\n\n# Person One (person1)\n\n\n\n#'
+                b' Status Tracking\n\n',
                 '/output_dir/person2.mdwn': b'<!-- autogenerated by '
-                b'budget-sync -->\n\n# person2\n\n\n\n# Status Tracking\n\n',
+                b'budget-sync -->\n\n# Person Two (person2)\n\n\n\n#'
+                b' Status Tracking\n\n',
             }, filesystem.files)
     # TODO: add more test cases
 
index c0092d2215b69f3106c78b66f247e284f7ed022e..f042ff042d2ca23174b654b535eef85cedcafdea 100644 (file)
@@ -104,7 +104,7 @@ def _markdown_for_person(person: Person,
                          assigned_nodes: List[Node]) -> str:
     writer = MarkdownWriter()
     print(f"<!-- autogenerated by budget-sync -->", file=writer.buffer)
-    writer.write_headers([f"\n# {person.identifier}\n"])
+    writer.write_headers([f"\n# {person.full_name} ({person.identifier})\n"])
     print(file=writer.buffer)
     status_tracking_header = "\n# Status Tracking\n"
     writer.write_headers([status_tracking_header])