forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename pylint plugin and add tests. (ansible#70225)
* Renamed custom pylint plugin for unwanted names. * Add integration tests for sanity test failures.
- Loading branch information
Showing
7 changed files
with
118 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- ansible-test - Changed the internal name of the custom plugin used to identify use of unwanted imports and functions. |
34 changes: 34 additions & 0 deletions
34
test/integration/targets/ansible-test/ansible_collections/ns/col/plugins/modules/bad.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/python | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
from __future__ import absolute_import, division, print_function | ||
__metaclass__ = type | ||
|
||
DOCUMENTATION = ''' | ||
module: bad | ||
short_description: Bad test module | ||
description: Bad test module. | ||
author: | ||
- Ansible Core Team | ||
''' | ||
|
||
EXAMPLES = ''' | ||
- bad: | ||
''' | ||
|
||
RETURN = '''''' | ||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
from ansible import constants # intentionally trigger pylint ansible-bad-module-import error | ||
|
||
|
||
def main(): | ||
module = AnsibleModule( | ||
argument_spec=dict(), | ||
) | ||
|
||
module.exit_json() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
16 changes: 16 additions & 0 deletions
16
...gets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import absolute_import, division, print_function | ||
__metaclass__ = type | ||
|
||
import tempfile | ||
|
||
try: | ||
import urllib2 # intentionally trigger pylint ansible-bad-import error | ||
except ImportError: | ||
urllib2 = None | ||
|
||
try: | ||
from urllib2 import Request # intentionally trigger pylint ansible-bad-import-from error | ||
except ImportError: | ||
Request = None | ||
|
||
tempfile.mktemp() # intentionally trigger pylint ansible-bad-function error |
5 changes: 5 additions & 0 deletions
5
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/sanity/ignore.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
plugins/modules/bad.py import | ||
plugins/modules/bad.py pylint:ansible-bad-module-import | ||
tests/integration/targets/hello/files/bad.py pylint:ansible-bad-function | ||
tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import | ||
tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import-from |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters