def test()

in bowler/main.py [0:0]


def test(codemod: str) -> None:
    """
    Run the tests in the codemod file
    """

    # TODO: Unify the import code between 'run' and 'test'
    module_name_from_codemod = os.path.basename(codemod).replace(".py", "")
    spec = importlib.util.spec_from_file_location(module_name_from_codemod, codemod)
    foo = importlib.util.module_from_spec(spec)
    cast(Loader, spec.loader).exec_module(foo)
    suite = unittest.TestLoader().loadTestsFromModule(foo)

    result = unittest.TextTestRunner().run(suite)
    sys.exit(not result.wasSuccessful())