Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add malformed tests check #177

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bioconda_utils/lint_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 22 additions & 0 deletions test/test_linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down