예제 #1
0
def test_indent():
    misindented_files_paths = [
        path for path in get_misindented_files() if "src/" not in path[0]
    ]
    warn_and_assert(
        misindented_files_paths,
        "{0} is not indented as expected",
        "Files are not indented as expected. See warnings below",
    )
def test_versioned_release_schema():
    """
    Ensures the extension contains no versioned-release-validation-schema.json file.
    """
    path = 'versioned-release-validation-schema.json'
    if os.path.exists(path):
        warn_and_assert(
            [path], '{0} is present, run: rm {0}',
            'Versioned release schema files are present. See warnings below.')
def test_indent():
    def include(path, name):
        # http://json-schema.org/draft-04/schema
        return name not in ('json-schema-draft-4.json', 'package.json',
                            'package-lock.json')

    warn_and_assert(
        get_misindented_files(include),
        '{0} is not indented as expected, run: ocdskit indent {0}',
        'Files are not indented as expected. See warnings below, or run: ocdskit indent -r .'
    )
def test_empty():
    def include(path, name):
        return name not in {'.gitkeep', 'py.typed'} and (
            # Template repositories are allowed to have empty schema files.
            name not in {
                'record-package-schema.json', 'release-package-schema.json',
                'release-schema.json'
            } or repo_name not in {
                'standard_extension_template', 'standard_profile_template'
            })

    warn_and_assert(get_empty_files(include), '{0} is empty, run: rm {0}',
                    'Files are empty. See warnings below.')
예제 #5
0
def test_csv_valid():
    warn_and_assert(get_invalid_csv_files(), '{0} is not valid CSV: {1}',
                    'CSV files are invalid. See warnings below.')
예제 #6
0
def test_invalid_json():
    warn_and_assert(get_invalid_json_files(), "{0} is not valid JSON: {1}",
                    "JSON files are invalid. See warnings below.")
예제 #7
0
def test_empty():
    empty_files_paths = [
        path for path in get_empty_files() if "src/" not in path[0]
    ]
    warn_and_assert(empty_files_paths, "{0} is empty, run: rm {0}",
                    "Files are empty. See warnings below.")
def test_json_valid():
    excluded = ('.git', '.ve', '_static', 'build', 'fixtures', 'node_modules')
    warn_and_assert(get_invalid_json_files(excluded=excluded),
                    '{0} is not valid JSON: {1}',
                    'JSON files are invalid. See warnings below.')