How to run ansible 2.10 in a tox venv?

https://github.com/ansible-collections/overview/blob/master/README.rst#pre-release-versions-of-ansible-base

I think this should work?
"Checkout and run the source https://github.com/ansible-collection-migration/ansible-base (pip install in a Python virtual environment, or do source hacking/env-setup)"

So something like this in my tox.ini?

deps =
git+https://github.com/ansible-collection-migration/ansible-base.git@devel#egg=pkg

However, there are no modules installed - I think it is because the MANIFEST.in excludes them? https://github.com/ansible-collection-migration/ansible-base/blob/devel/MANIFEST.in

recursive-include lib/ansible/module_utils/powershell *.psm1
recursive-include lib/ansible/modules/windows *.ps1
recursive-include lib/ansible/galaxy/data *.yml *.j2 README.md ansible.cfg inventory .git_keep

because that's exactly what I see in .tox/env-py38-ansible210/lib/python3.8/site-packages/ansible/modules/

Will I have to use the `source hacking/env-setup` method to use ansible2.10 in my tox env? If so, does anyone have any examples about how to do this?

Hi Rich,

You can install from git+https://github.com/ansible/ansible.git@devel as a dep in your tox.ini. At least it works for me to test Ansible roles against devel (https://github.com/cchurch/ansible-role-testing/blob/master/tox.ini#L21).

Hi Rich,

You can install from git+https://github.com/ansible/ansible.git@devel as a dep in your tox.ini. At least it works for me to test Ansible roles against devel (https://github.com/cchurch/ansible-role-testing/blob/master/tox.ini#L21).

This works. Thanks!

Rich, as far as ansible-base is concerned, there is/was a bug that was errantly removing __ini__.py files, which is likely the cause on python2. It’s being worked on currently.

fwiw, ansible/ansible is more similar to Ansible 2.9 at this point. ansible-base is what ansible/ansible will look like on March 23.

Rich, as far as ansible-base is concerned, there is/was a bug that was errantly removing `__ini__.py` files, which is likely the cause on python2. It's being worked on currently.

Is there an issue/pr that I can follow? I would like to run my tests with as close to ansible 2.10 as possible.

Also, I tested with python3, so at least for me, the problem manifested using other than python2 (or I'm running into a separate issue).

I’ve tested more, and can not reproduce this. Installing ansible-base I do have modules installed.

I’ve not tested in tox, but depending if you have ansible installed in a place where tox can see, that may cause issues.

I've tested more, and can not reproduce this. Installing ansible-base I do have modules installed.

I've not tested in tox, but depending if you have ansible installed in a place where tox can see, that may cause issues.

It's working now - not sure why it wasn't before.

Something like this:

commands_pre =
     bash {toxinidir}/install_ansible_for_testing.sh {envdir}/ansible devel
commands =
     bash {toxinidir}/run_ansible_for_testing.sh {envdir}/ansible bash {toxinidir}/run_tests.sh

where install downloads it from github (if it doesn't already exist), and run does a `source {envdir}/ansible/hacking/env-setup` before running the rest of the command line.