ansible/pytest-ansible

[DEPRECATION WARNING]: ansible.constants.BECOME_METHODS is deprecated

edwinpjacques opened this issue · 3 comments

I am using Ansible 2.8.1. I get this error when I install pytest-ansible and run py.test:

[DEPRECATION WARNING]: ansible.constants.BECOME_METHODS is deprecated, please use ansible.plugins.loader.become_loader. This list is statically defined and may not include all become methods. This feature will be removed in
version 2.10. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

I can suppress deprecation warnings to hide this, but would rather not. This is not ideal.

It appears that no longer supporting BECOME_METHODS could break compatibility with old versions of Ansible. Maybe that's ok. Need some guidance. If I knew what I had to do, I'd make a PR.

Looks like https://github.com/ansible/pytest-ansible/pull/40/files should fix it, just needs to get rebased and merged.

Looks like I messed up import in attempt to support both older and newer versions of ansible, but the above PR fixes it to use newer become_loader when available

@kdelee with #40 being merged can we consider this done?

@elyezer I beleive so, also I just cut a new release with this code in it and pushed to pypi. Going to close this. Please report if you do not see improvements

release on github: https://github.com/ansible/pytest-ansible/releases/tag/v2.2.2