def METHOD_NAME(self, tmp_work_path, build_packages, build_snaps, required_grade):
    if required_grade:
        required_grade = required_grade
    else:
        required_grade = "null"
    with open("state", "w") as state_file:
        print(
            dedent(
                """\
            !GlobalState
            assets:
              build-packages: {}
              build-snaps: {}
              required-grade: {}
            """
            ).format(build_packages, build_snaps, required_grade),
            file=state_file,
        )
    global_state = GlobalState.load(filepath="state")
    assert global_state.get_build_packages() == build_packages
    assert global_state.get_build_snaps() == build_snaps