def test_no_destination_exception(*_):
    profile_name = "my_profile.yaml"
    destination_path = ""
    destination_name = "tuning.yaml"
    destination = os.path.join(destination_path, destination_name)

    with pytest.raises(OSError):
        export_tuning_variables(profile_name, destination)

    # noinspection PyUnresolvedReferences
    yacfg.output.ensure_output_path.assert_not_called()
    # noinspection PyUnresolvedReferences
    yacfg.output.write_output.assert_called()
def test_true(*_):
    profile_name = "my_profile.yaml"
    destination_path = "/destination/path/tuning"
    destination_name = "tuning.yaml"
    destination = os.path.join(destination_path, destination_name)

    expected_data = fake_profile_defaults_yaml()
    expected_data = "# {} tuning file generated from profile {}{}---{}{}".format(
        NAME, profile_name, os.linesep, os.linesep, expected_data)

    export_tuning_variables(profile_name, destination)

    # noinspection PyUnresolvedReferences
    yacfg.output.ensure_output_path.assert_called_with(destination_path)
    # noinspection PyUnresolvedReferences
    yacfg.output.write_output.assert_called_with(destination_name,
                                                 destination_path,
                                                 expected_data)