Skip to content

Commit e1859ea

Browse files
committed
Add pandas as test requirement and hack by converting to medvedi
Signed-off-by: Lou Marvin Caraig <[email protected]>
1 parent 0ccf6ec commit e1859ea

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

server/requirements-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ filelock==3.10.6
1212
faker==18.4.0
1313
nest_asyncio==1.5.6
1414
factory-boy==3.2.1
15+
pandas==2.2.3

server/tests/internal/miners/github/test_check_run_benchmark.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pathlib import Path
44
import pickle
55

6+
import medvedi as md
67
from medvedi.merge_to_str import merge_to_str
78
import numpy as np
89
import pandas as pd
@@ -249,12 +250,20 @@ def test_mine_check_runs_wrap(benchmark, no_deprecation_warnings):
249250
)
250251
for col in (
251252
CheckRun.started_at,
253+
CheckRun.authored_date,
252254
CheckRun.completed_at,
253255
CheckRun.pull_request_created_at,
254256
CheckRun.pull_request_closed_at,
255257
CheckRun.committed_date,
256258
check_suite_started_column,
257259
):
258260
col_name = col.name if not isinstance(col, str) else col
259-
df[col_name] = df[col_name].astype(np.datetime64)
260-
benchmark(_finalize_check_runs, df, logging.getLogger("pytest.alternative_facts"))
261+
df[col_name] = pd.to_datetime(df[col_name], format='ISO8601')\
262+
.dt.tz_localize(None)\
263+
.astype(np.dtype('datetime64[ns]'))
264+
265+
df[CheckRun.status.name] = df[CheckRun.status.name].astype("S")
266+
df = md.DataFrame(df.to_dict("series"))
267+
268+
benchmark(_finalize_check_runs, df,
269+
logging.getLogger("pytest.alternative_facts"))

0 commit comments

Comments
 (0)