run#

graftkit.testing.run(root: Path | None, *args: str, extension: Extension | None = None, github: Fetcher | None = None, git: Git | None = None) → Result[source]#

Run the CLI in a root, in this process, and capture what it printed.

Parameters:
rootPath | None

The root, or None to run outside any repository.

extensionExtension | None

An extension to use as the root’s instead of its entry point, so an extension tests its commands before its package is installed. Ignored outside a root.

githubFetcher | None

Read access to GitHub, e.g. a FakeGitHub; default the real gh.

gitGit | None

Changes checkouts and opens pull requests, e.g. a FakeGit; default the real git and gh.

argsstr

The arguments after graftkit.

Returns:
Result

The result.