ansible-collections / ibm_zos_core

Red Hat Ansible Certified Content for IBM Z
75 stars 44 forks source link

[Enabler]Update_test_suites_to_be_pylint _correct #1441

Closed AndreMarcel99 closed 1 week ago

AndreMarcel99 commented 2 months ago

Is there an existing issue for this?

Enabler description

The current test suite is not review by pylint and not follow up by pep8 rules. To get a better result (6.26 current) by working with the recommendations of pylint command and remove all print and pprint statements. Also could be tested to see results. Commands to connect to EC:

ssh-keygen -t ecdsa -b 521
ssh-copy-id -i ~/.ssh/id_ecdsa omvsadm@ec01130a.vmec.svl.ibm.com (Run every mondar)

Create the collection: On dev branch on ibm_zos_core folder run:

ansible-galaxy collection build -f
ansible-galaxy collection install -cf [collection_build]

Test suites:

./functional/module_utils/test_arg_parser.py
./functional/modules/test_zos_script_func.py
./functional/modules/test_zos_find_func.py
./functional/modules/test_zos_copy_func.py
./functional/modules/test_module_security.py
./functional/modules/test_zos_mount_func.py
./functional/modules/test_zos_data_set_func.py
./functional/modules/test_zos_volume_init_func.py
./functional/modules/test_zos_ping_func.py
./functional/modules/test_zos_job_query_func.py
./functional/modules/test_zos_job_output_func.py
./functional/modules/test_zos_operator_func.py
./functional/modules/test_zos_lineinfile_func.py
./functional/modules/test_zos_gather_facts_func.py
./functional/modules/test_zos_unarchive_func.py
./functional/modules/test_zos_apf_func.py
./functional/modules/test_zos_fetch_func.py
./functional/modules/test_zos_backup_restore.py
./functional/modules/test_zos_encode_func.py
./functional/modules/test_zos_blockinfile_func.py
./functional/modules/test_zos_mvs_raw_func.py
./functional/modules/test_zos_operator_action_query_func.py
./functional/modules/test_zos_tso_command_func.py
./functional/modules/test_zos_job_submit_func.py
./functional/modules/test_zos_archive_func.py
./unit/test_zos_gather_facts.py
./unit/test_zos_operator_unit.py
./unit/test_zoau_version_checker_unit.py
./unit/test_zos_mvs_raw_unit.py
./unit/test_zos_backup_restore_unit.py
./unit/test_zos_operator_action_query_unit.py

And commands to see problems pylint [test_suite] Run on test folder. Commands for run test: export ANSIBLE_ACTION_PLUGINS=~/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/action && export ANSIBLE_MODULE_UTILS=~/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/module_utils && export ANSIBLE_LIBRARY=~/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules Command to run specific_test: Run on test folder python3 -m pytest -v -s -k "[test_name]" --host-pattern=all --zinventory=/Users/andre/Desktop/work_2024/ibm_zos_core/tests/test_config.yml functional/modules/[Test_suite]

test_config.yml

host: ec01130a.vmec.svl.ibm.com
user: omvsadm
python_path: /allpython/3.11-3/usr/lpp/IBM/cyp/v3r11/pyz/bin/python3.11
environment:
  _BPXK_AUTOCVT: "ON"
  _CEE_RUNOPTS: "'FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'"
  _TAG_REDIR_ERR: txt
  _TAG_REDIR_IN: txt
  _TAG_REDIR_OUT: txt
  LANG: C
  ZOAU_ROOT: "/zoau/v1.3.0"
  ZOAU_HOME: "/zoau/v1.3.0"
  LIBPATH: "/zoau/v1.3.0/lib:/allpython/3.11-3/usr/lpp/IBM/cyp/v3r11/pyz/lib:/lib:/usr/lib:."
  ZOAUTIL_DIR: "/zoau/v1.3.0"
  PYTHONPATH: "/zoau/v1.3.0/lib"
  PATH: "/zoau/v1.3.0/bin:/allpython/3.11-3/usr/lpp/IBM/cyp/v3r11/pyz/bin:/bin:/var/bin"
VOLUMES:
  - '000000'
  - '222222'

Ansible module

No response