8000 feat(tests): Add optional cutoff to toxgen (#4243) · getsentry/sentry-python@7cb0451 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7cb0451

Browse files
authored
feat(tests): Add optional cutoff to toxgen (#4243)
This will be useful to identify old versions of packages when we're doing a deprecation round.
1 parent 2ba4ed0 commit 7cb0451

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scripts/populate_tox/populate_tox.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import time
1010
from bisect import bisect_left
1111
from collections import defaultdict
12-
from datetime import datetime, timezone
12+
from datetime import datetime, timedelta, timezone # noqa: F401
1313
from importlib.metadata import metadata
1414
from packaging.specifiers import SpecifierSet
1515
from packaging.version import Version
@@ -29,6 +29,10 @@
2929
from split_tox_gh_actions.split_tox_gh_actions import GROUPS
3030

3131

32+
# Set CUTOFF this to a datetime to ignore packages older than CUTOFF
33+
CUTOFF = None
34+
# CUTOFF = datetime.now(tz=timezone.utc) - timedelta(days=365 * 5)
35+
3236
TOX_FILE = Path(__file__).resolve().parent.parent.parent / "tox.ini"
3337
ENV = Environment(
3438
loader=FileSystemLoader(Path(__file__).resolve().parent),
@@ -162,9 +166,13 @@ def _prefilter_releases(
162166
if meta["yanked"]:
163167
continue
164168

165-
if older_than is not None:
166-
if datetime.fromisoformat(meta["upload_time_iso_8601"]) > older_than:
167-
continue
169+
uploaded = datetime.fromisoformat(meta["upload_time_iso_8601"])
170+
171+
if older_than is not None and uploaded > older_than:
172+
continue
173+
174+
if CUTOFF is not None and uploaded < CUTOFF:
175+
continue
168176

169177
version = Version(release)
170178

0 commit comments

Comments
 (0)
0