mass_driver.tests.fixtures

Reusable fixtures for mass-driver testing

Module Contents

Functions

repoize

Create a git repo with inital commit at path

copy_folder

Copy the repo_data folder to tmp_path

massdrive_runlocal

Run ‘mass-driver run’ with a local repo and activity config

massdrive

Run mass-driver with given activityconfig over a sample LOCAL repo

massdrive_check_file

Run mass-driver migration.toml over input.yaml and check the output.yaml matches

massdrive_scan_check

Scan mass-driver over workdir and check the scan_results.json matches

API

mass_driver.tests.fixtures.repoize(path: pathlib.Path)[source]

Create a git repo with inital commit at path

mass_driver.tests.fixtures.copy_folder(repo_data, tmp_path)[source]

Copy the repo_data folder to tmp_path

mass_driver.tests.fixtures.massdrive_runlocal(repo_url: str | None, activity_configfilepath: pathlib.Path) mass_driver.models.activity.ActivityOutcome[source]

Run ‘mass-driver run’ with a local repo and activity config

Returns: ActivityOutcome of the execution

mass_driver.tests.fixtures.massdrive(repo_url: str, activity_configfilepath: pathlib.Path, repo_is_path: bool = True)[source]

Run mass-driver with given activityconfig over a sample LOCAL repo

The “repo” is either a local folder path which we’ll ‘git init && git commit -Am’ over, or a cloneable URL in which case we will pass it through.

We will rely on repo_is_path variable to determine if we need to masquerade the local path as a git repo or not. This means if giving a proper git cloneable URL, set repo_is_path=False.

Note: See pytest-datadir’s “datadir” fixture for convenient data linking

Returns: A tuple of (PatchResult, ForgeResult, ScanResult) returned by mass-driver for that repo. If any of these activities are empty, None is given for it.

mass_driver.tests.fixtures.massdrive_check_file(workdir: pathlib.Path)[source]

Run mass-driver migration.toml over input.yaml and check the output.yaml matches

Returns: tuple of mutated vs reference file if passing result.PATCHED_OK assertion

mass_driver.tests.fixtures.massdrive_scan_check(workdir: pathlib.Path)[source]

Scan mass-driver over workdir and check the scan_results.json matches

Returns: tuple of scan_results dict + reference_results dict, for comparison by caller