Skip to content

Commit 320f62d

Browse files
committed
use temporary directory instead of managing the local feedstock dir manually
1 parent a6755e0 commit 320f62d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

conda_forge_tick/auto_tick.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,34 @@ def run(
476476
rerender: bool = True,
477477
base_branch: str = "main",
478478
**kwargs: typing.Any,
479+
) -> tuple[MigrationUidTypedDict, dict] | tuple[Literal[False], Literal[False]]:
480+
"""
481+
For a given feedstock and migration run the migration in a temporary directory that will be deleted after the
482+
migration is complete.
483+
484+
The parameters are the same as for the `run` function. The only difference is that you pass a FeedstockContext
485+
instance instead of a ClonedFeedstockContext instance.
486+
487+
The exceptions are the same as for the `run` function.
488+
"""
489+
with context.reserve_clone_directory() as cloned_context:
490+
return run(
491+
context=cloned_context,
492+
migrator=migrator,
493+
rerender=rerender,
494+
base_branch=base_branch,
495+
dry_run=dry_run,
496+
**kwargs,
497+
)
498+
499+
500+
def run(
501+
context: ClonedFeedstockContext,
502+
migrator: Migrator,
503+
rerender: bool = True,
504+
base_branch: str = "main",
505+
dry_run: bool = False,
506+
**kwargs: typing.Any,
479507
) -> tuple[MigrationUidTypedDict, dict] | tuple[Literal[False], Literal[False]]:
480508
"""For a given feedstock and migration run the migration
481509

tests/test_contexts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
}
2727
)
2828

29+
2930
def test_feedstock_context_default_branch_not_set():
3031
context = FeedstockContext("TEST-FEEDSTOCK-NAME", demo_attrs)
3132
assert context.default_branch == "main"

0 commit comments

Comments
 (0)