mirror of https://github.com/ansible/ansible.git
Rename pylint plugin and add tests. (#70225)
* Renamed custom pylint plugin for unwanted names. * Add integration tests for sanity test failures.pull/70228/head
parent
4816bb4f43
commit
fa48678a08
@ -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.
|
@ -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()
|
@ -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
|
@ -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
|
Loading…
Reference in New Issue