def METHOD_NAME(
    cancel_method: str,
    main: Callable,
) -> None:
    '''
    Run our runtime under trio and expect a certain type of cancel condition
    depending on input.
    '''
    cancelled_msg: str = (
        "was remotely cancelled by remote actor (\'pikerd\'")
    if cancel_method == 'sigint':
        with pytest.raises(
            BaseExceptionGroup,
        ) as exc_info:
            trio.run(main)
        multi = exc_info.value
        for suberr in multi.exceptions:
            match suberr:
                # ensure we receive a remote cancellation error caused
                # by the pikerd root actor since we used the
                # `.cancel_service()` API above B)
                case tractor.ContextCancelled():
                    assert cancelled_msg in suberr.args[0]
                case KeyboardInterrupt():
                    pass
                case _:
                    pytest.fail(f'Unexpected error {suberr}')
    elif cancel_method == 'services':
        # XXX NOTE: oddly, when you pass --pdb to pytest, i think since
        # we also use that to enable the underlying tractor debug mode,
        # it causes this to not raise for some reason? So if you see
        # that while changing this test.. it's prolly that.
        with pytest.raises(
            tractor.ContextCancelled
        ) as exc_info:
            trio.run(main)
        assert cancelled_msg in exc_info.value.args[0]
    else:
        pytest.fail(f'Test is broken due to {cancel_method}')