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 support for enhanced code-smell tests. #36332

Merged
merged 3 commits into from
Feb 20, 2018

Conversation

mattclay
Copy link
Member

SUMMARY

Add support for enhanced code-smell tests:

  • Path selection handled by ansible-test.
  • Optional path filtering based on extension.
  • Optional path filtering based on prefixes.
  • Optional lint friendly output.

Two code-smell tests have been updated to use these new features:

  • no-assert
  • no-tests-as-filters
ISSUE TYPE

Feature Pull Request

COMPONENT NAME

ansible-test

ANSIBLE VERSION
ansible 2.6.0 (at-code-smell 65f24d5b90) last updated 2018/02/16 12:42:51 (GMT -700)
  config file = None
  configured module search path = [u'/Users/mclay/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mclay/code/mattclay/ansible/lib/ansible
  executable location = /Users/mclay/code/mattclay/ansible/bin/ansible
  python version = 2.7.11 (default, Jan 22 2016, 08:29:18) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]

- Path selection handled by ansible-test.
- Optional path filtering based on extension.
- Optional path filtering based on prefixes.
- Optional lint friendly output.
@ansibot ansibot added feature_pull_request needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests. labels Feb 16, 2018
@mattclay mattclay removed the needs_triage Needs a first human triage before being processed. label Feb 16, 2018
@sivel
Copy link
Member

sivel commented Feb 20, 2018

I've tested both modified tests and they work as expected:

Sanity check using no-tests-as-filters
ERROR: Found 1 no-tests-as-filters issue(s) which need to be resolved:
ERROR: boom.yml:11:13: use `boom is failed` instead of `boom | failed`
ERROR: The 1 sanity test(s) listed below (out of 1) failed. See error output above for details.
no-tests-as-filters
Sanity check using no-assert
ERROR: Found 1 no-assert issue(s) which need to be resolved:
ERROR: lib/ansible/boom.py:1:1: raise AssertionError instead of: assert '1' == '2'
ERROR: The 1 sanity test(s) listed below (out of 1) failed. See error output above for details.
no-assert

LGTM

@mattclay mattclay merged commit 2b6ac45 into ansible:devel Feb 20, 2018
@mattclay mattclay deleted the at-code-smell branch February 20, 2018 21:37
@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_pull_request labels Mar 5, 2018
@ansible ansible locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue/PR relates to a feature request. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants