|
17 | 17 |
|
18 | 18 | class TestWriteToMarkdown(unittest.TestCase):
|
19 | 19 | """Test the write_to_markdown function."""
|
| 20 | + |
20 | 21 | maxDiff = None
|
21 | 22 |
|
22 | 23 | def test_write_to_markdown(self):
|
@@ -50,21 +51,25 @@ def test_write_to_markdown(self):
|
50 | 51 | ),
|
51 | 52 | ]
|
52 | 53 | time_to_first_response = {
|
53 |
| - 'avg': timedelta(days=2), |
54 |
| - 'med': timedelta(days=2), |
55 |
| - '90p': timedelta(days=2)} |
| 54 | + "avg": timedelta(days=2), |
| 55 | + "med": timedelta(days=2), |
| 56 | + "90p": timedelta(days=2), |
| 57 | + } |
56 | 58 | time_to_close = {
|
57 |
| - 'avg': timedelta(days=3), |
58 |
| - 'med': timedelta(days=3), |
59 |
| - '90p': timedelta(days=3)} |
| 59 | + "avg": timedelta(days=3), |
| 60 | + "med": timedelta(days=3), |
| 61 | + "90p": timedelta(days=3), |
| 62 | + } |
60 | 63 | time_to_answer = {
|
61 |
| - 'avg': timedelta(days=4), |
62 |
| - 'med': timedelta(days=4), |
63 |
| - '90p': timedelta(days=4)} |
| 64 | + "avg": timedelta(days=4), |
| 65 | + "med": timedelta(days=4), |
| 66 | + "90p": timedelta(days=4), |
| 67 | + } |
64 | 68 | time_in_labels = {
|
65 |
| - 'avg': {"bug": "1 day, 12:00:00"}, |
66 |
| - 'med': {"bug": "1 day, 12:00:00"}, |
67 |
| - '90p': {"bug": "1 day, 12:00:00"}} |
| 69 | + "avg": {"bug": "1 day, 12:00:00"}, |
| 70 | + "med": {"bug": "1 day, 12:00:00"}, |
| 71 | + "90p": {"bug": "1 day, 12:00:00"}, |
| 72 | + } |
68 | 73 |
|
69 | 74 | num_issues_opened = 2
|
70 | 75 | num_issues_closed = 1
|
@@ -93,6 +98,9 @@ def test_write_to_markdown(self):
|
93 | 98 | "| Time to close | 3 days, 0:00:00 | 3 days, 0:00:00 | 3 days, 0:00:00 |\n"
|
94 | 99 | "| Time to answer | 4 days, 0:00:00 | 4 days, 0:00:00 | 4 days, 0:00:00 |\n"
|
95 | 100 | "| Time spent in bug | 1 day, 12:00:00 | 1 day, 12:00:00 | 1 day, 12:00:00 |\n"
|
| 101 | + "\n" |
| 102 | + "| Metric | Count |\n" |
| 103 | + "| --- | ---: |\n" |
96 | 104 | "| Number of items that remain open | 2 |\n"
|
97 | 105 | "| Number of items closed | 1 |\n"
|
98 | 106 | "| Total number of items created | 2 |\n\n"
|
@@ -140,21 +148,25 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
|
140 | 148 | ),
|
141 | 149 | ]
|
142 | 150 | average_time_to_first_response = {
|
143 |
| - 'avg': timedelta(days=2), |
144 |
| - 'med': timedelta(days=2), |
145 |
| - '90p': timedelta(days=2)} |
| 151 | + "avg": timedelta(days=2), |
| 152 | + "med": timedelta(days=2), |
| 153 | + "90p": timedelta(days=2), |
| 154 | + } |
146 | 155 | average_time_to_close = {
|
147 |
| - 'avg': timedelta(days=3), |
148 |
| - 'med': timedelta(days=3), |
149 |
| - '90p': timedelta(days=3)} |
| 156 | + "avg": timedelta(days=3), |
| 157 | + "med": timedelta(days=3), |
| 158 | + "90p": timedelta(days=3), |
| 159 | + } |
150 | 160 | average_time_to_answer = {
|
151 |
| - 'avg': timedelta(days=4), |
152 |
| - 'med': timedelta(days=4), |
153 |
| - '90p': timedelta(days=4)} |
| 161 | + "avg": timedelta(days=4), |
| 162 | + "med": timedelta(days=4), |
| 163 | + "90p": timedelta(days=4), |
| 164 | + } |
154 | 165 | average_time_in_labels = {
|
155 |
| - 'avg': {"bug": "1 day, 12:00:00"}, |
156 |
| - 'med': {"bug": "1 day, 12:00:00"}, |
157 |
| - '90p': {"bug": "1 day, 12:00:00"}} |
| 166 | + "avg": {"bug": "1 day, 12:00:00"}, |
| 167 | + "med": {"bug": "1 day, 12:00:00"}, |
| 168 | + "90p": {"bug": "1 day, 12:00:00"}, |
| 169 | + } |
158 | 170 |
|
159 | 171 | num_issues_opened = 2
|
160 | 172 | num_issues_closed = 1
|
@@ -182,6 +194,9 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
|
182 | 194 | "| Time to close | 3 days, 0:00:00 | 3 days, 0:00:00 | 3 days, 0:00:00 |\n"
|
183 | 195 | "| Time to answer | 4 days, 0:00:00 | 4 days, 0:00:00 | 4 days, 0:00:00 |\n"
|
184 | 196 | "| Time spent in bug | 1 day, 12:00:00 | 1 day, 12:00:00 | 1 day, 12:00:00 |\n"
|
| 197 | + "\n" |
| 198 | + "| Metric | Count |\n" |
| 199 | + "| --- | ---: |\n" |
185 | 200 | "| Number of items that remain open | 2 |\n"
|
186 | 201 | "| Number of items closed | 1 |\n"
|
187 | 202 | "| Total number of items created | 2 |\n\n"
|
@@ -279,15 +294,16 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
|
279 | 294 | num_issues_closed=num_issues_closed,
|
280 | 295 | labels=["label1"],
|
281 | 296 | search_query="repo:user/repo is:issue",
|
| 297 | + hide_label_metrics=True, |
282 | 298 | )
|
283 | 299 |
|
284 | 300 | # Check that the function writes the correct markdown file
|
285 | 301 | with open("issue_metrics.md", "r", encoding="utf-8") as file:
|
286 | 302 | content = file.read()
|
287 | 303 | expected_content = (
|
288 | 304 | "# Issue Metrics\n\n"
|
289 |
| - "| Metric | Average | Median | 90th percentile |\n" |
290 |
| - "| --- | --- | --- | ---: |\n" |
| 305 | + "| Metric | Count |\n" |
| 306 | + "| --- | ---: |\n" |
291 | 307 | "| Number of items that remain open | 2 |\n"
|
292 | 308 | "| Number of items closed | 1 |\n"
|
293 | 309 | "| Total number of items created | 2 |\n\n"
|
|
0 commit comments