def create_test_function(test_manifest_loc, test_name, check_parse=True, regen=False):
    """
    Return a test function closed on test arguments for `test_manifest_loc`
    location and with `test_name` method name..

    If check_parse is True, test the parse_manifest; otherwise, test the package
    data normalization.
    """
    # closure on the test params
    if check_parse:
        def test_manifest(self):
            self.check_parse_manifest(test_manifest_loc, regen)
    else:
        def test_manifest(self):
            self.check_get_normalized_package_data(test_manifest_loc, regen)

    # set a proper function name to display in reports and use in discovery
    # function names are best as bytes
    if isinstance(test_name, bytes):
        test_name = test_name.decode('utf-8')
    test_manifest.__name__ = test_name
    return test_manifest