def test_lint_skip_in_recipe():

    # should fail (note we're only linting `missing_home`)
    r = Recipes('''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
        ''',
                from_string=True)
    r.write_recipes()
    res = linting.lint(
        r.recipe_dirs.values(),
        linting.LintArgs(registry=[lint_functions.missing_home]),
        basedir=r.basedir)
    assert res is not None

    # should now pass with the extra:skip-lints (only linting for `missing_home`)
    r = Recipes('''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
            extra:
              skip-lints:
                - missing_home
        ''',
                from_string=True)
    r.write_recipes()
    res = linting.lint(
        r.recipe_dirs.values(),
        linting.LintArgs(registry=[lint_functions.missing_home]),
        basedir=r.basedir)
    assert res is None

    # should pass; minimal recipe needs to skip these lints
    r = Recipes('''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
            extra:
              skip-lints:
                - missing_home
                - missing_license
                - no_tests
                - in_other_channels  # avoid triggering RepoData load
        ''',
                from_string=True)
    r.write_recipes()
    res = linting.lint(r.recipe_dirs.values(),
                       linting.LintArgs(),
                       basedir=r.basedir)
    assert res is not None
Example #2
0
def test_lint_skip_in_recipe():

    # should fail (note we're only linting `missing_home`)
    r = Recipes(
        '''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
        ''', from_string=True)
    r.write_recipes()
    res = linting.lint(
        r.recipe_dirs.values(),
        linting.LintArgs(registry=[lint_functions.missing_home]),
        basedir=r.basedir)
    assert res is not None

    # should now pass with the extra:skip-lints (only linting for `missing_home`)
    r = Recipes(
        '''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
            extra:
              skip-lints:
                - missing_home
        ''', from_string=True)
    r.write_recipes()
    res = linting.lint(
        r.recipe_dirs.values(),
        linting.LintArgs(registry=[lint_functions.missing_home]),
        basedir=r.basedir)
    assert res is None

    # should pass; minimal recipe needs to skip these lints
    r = Recipes(
        '''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
            extra:
              skip-lints:
                - missing_home
                - missing_license
                - no_tests
                - in_other_channels  # avoid triggering RepoData load
        ''', from_string=True)
    r.write_recipes()
    res = linting.lint(r.recipe_dirs.values(), linting.LintArgs(),
        basedir=r.basedir)
    assert res is not None
Example #3
0
def test_lint_skip_in_recipe():

    # should fail (note we're only linting `missing_home`)
    r = Recipes('''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
        ''',
                from_string=True)
    r.write_recipes()
    res = linting.lint(r.recipe_dirs.values(),
                       config={},
                       df=None,
                       registry=[lint_functions.missing_home])
    assert res is not None

    # should now pass with the extra:skip-lints (only linting for `missing_home`)
    r = Recipes('''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
            extra:
              skip-lints:
                - missing_home
        ''',
                from_string=True)
    r.write_recipes()
    res = linting.lint(r.recipe_dirs.values(),
                       config={},
                       df=None,
                       registry=[lint_functions.missing_home])
    assert res is None

    # should pass; minimal recipe needs to skip these lints
    r = Recipes('''
        missing_home:
          meta.yaml: |
            package:
              name: missing_home
              version: "0.1"
            extra:
              skip-lints:
                - missing_home
                - missing_license
                - no_tests
        ''',
                from_string=True)
    r.write_recipes()
    res = linting.lint(r.recipe_dirs.values(), config={}, df=None)
    assert res is not None
Example #4
0
def test_empty_build_section():
    r = Recipes(
        '''
        empty_build_section:
          meta.yaml: |
            package:
              name: empty_build_section
              version: "0.1"
            build:
        ''', from_string=True)
    r.write_recipes()
    # access to contents of possibly empty build section can happen in
    # `should_be_noarch` and `should_not_be_noarch`
    registry = [lint_functions.should_be_noarch, lint_functions.should_not_be_noarch]
    res = linting.lint(r.recipe_dirs.values(), config={}, df=None, registry=registry)
    assert res is None
Example #5
0
def test_empty_build_section():
    r = Recipes(
        '''
        empty_build_section:
          meta.yaml: |
            package:
              name: empty_build_section
              version: "0.1"
            build:
        ''', from_string=True)
    r.write_recipes()
    # access to contents of possibly empty build section can happen in
    # `should_be_noarch` and `should_not_be_noarch`
    registry = [lint_functions.should_be_noarch, lint_functions.should_not_be_noarch]
    res = linting.lint(
        r.recipe_dirs.values(),
        linting.LintArgs(registry=registry),
        basedir=r.basedir
    )
    assert res is None