Skip to content

Commit a524a38

Browse files
committed
allow using a time machine
(this is important to keep the tests passing)
1 parent 7f2aedc commit a524a38

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

minimum_versions.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,19 @@ def format_bump_table(specs, policy_versions, releases, warnings, ignored_violat
314314
return grid
315315

316316

317+
def parse_date(string):
318+
return datetime.datetime.strptime(string, "%Y-%m-%d").date()
319+
320+
317321
@click.command()
318322
@click.argument(
319323
"environment_paths",
320324
type=click.Path(exists=True, readable=True, path_type=pathlib.Path),
321325
nargs=-1,
322326
)
323-
@click.option("--policy", "policy_file", type=click.File(mode="r"))
324-
def main(policy_file, environment_paths):
327+
@click.option("--today", type=parse_date, default=None)
328+
@click.option("--policy", "policy_file", type=click.File(mode="r"), required=True)
329+
def main(today, policy_file, environment_paths):
325330
console = Console()
326331

327332
policy = parse_policy(policy_file)
@@ -348,7 +353,8 @@ def main(policy_file, environment_paths):
348353
)
349354
records = asyncio.run(query)
350355

351-
today = datetime.date.today()
356+
if today is None:
357+
today = datetime.date.today()
352358
package_releases = pipe(
353359
records,
354360
concat,

0 commit comments

Comments
 (0)