diff --git a/bioconda_utils/lint_functions.py b/bioconda_utils/lint_functions.py index 7889123170..0837a444a9 100644 --- a/bioconda_utils/lint_functions.py +++ b/bioconda_utils/lint_functions.py @@ -149,6 +149,14 @@ def missing_tests(recipe, meta): } +@lint_multiple_metas +def malformed_tests(recipe, meta): + if any("'" in cmd for cmd in meta.get_value('test/commands', [])): + return { + 'single_quote_in_tests': True, + 'fix': 'use double quotes or move to separate test file' + } + @lint_multiple_metas def missing_hash(recipe, meta): # could be a meta-package if no source section or if None @@ -374,6 +382,7 @@ def compilers_must_be_in_build(recipe, meta): # disabling for now until we get better per-OS version detection # already_in_bioconda, + malformed_tests, missing_tests, missing_home, missing_license, diff --git a/test/test_linting.py b/test/test_linting.py index 37d5ab0900..ec4157cb24 100644 --- a/test/test_linting.py +++ b/test/test_linting.py @@ -287,6 +287,28 @@ def test_missing_tests(): ) +def test_single_quote_in_tests(): + run_lint( + func=lint_functions.malformed_tests, + should_pass=[''' + good_tests: + meta.yaml: | + package: + name: missing_tests + version: "0.1" + test: + commands: "ls" + '''], + should_fail=''' + bad_tests: + meta.yaml: | + package: + name: missing_tests + version: "0.1" + test: "ls | grep '[]'" + ''') + + def test_missing_hash(): run_lint( func=lint_functions.missing_hash,