def METHOD_NAME(alembic_config, config, migration, homedir):
    """
    Upgrade to one migration before the target migration (if there is one),
    load data, then upgrade in order to test that the upgrade is successful
    when there is data.
    """
    migrations = list_migrations(alembic_config, migration)
    if len(migrations) > 1:
        upgrade(alembic_config, migrations[-2])
    mod_name = "tests.migrations.test_{}".format(migration)
    mod = __import__(mod_name, fromlist=["UpgradeTester"])
    session = make_session_maker(homedir)
    upgrade_tester = mod.UpgradeTester(homedir, session)
    upgrade_tester.load_data()
    upgrade(alembic_config, migration)
    upgrade_tester.check_upgrade()