Hello,
How do I run a specific unit?
I would like to run: test/units/plugins/filter/test_ipaddr.py
I tried
$ ansible-test units --tox --python 2.7 ipaddr
ERROR: Target pattern not matched: ipaddr
and
$ pytest test/units/plugins/filter/test_ipaddr.py
============================================================================= test session starts ==============================================================================
platform darwin – Python 2.7.15, pytest-4.1.1, py-1.7.0, pluggy-0.8.1
rootdir: /Users/mzhukovskiy/learn/learn_python/ansible, inifile: tox.ini
collected 0 items / 1 errors
==================================================================================== ERRORS ====================================================================================
__________________________________________________________ ERROR collecting test/units/plugins/filter/test_ipaddr.py ___________________________________________________________
ImportError while importing test module ‘/Users/mzhukovskiy/learn/learn_python/ansible/test/units/plugins/filter/test_ipaddr.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…/…/…/.pyenv/versions/2.7.15/lib/python2.7/site-packages/six.py:709: in exec_
exec(“”“exec code in globs, locs”“”)
test/units/plugins/filter/test_ipaddr.py:25: in
from ansible.plugins.filter.ipaddr import (ipaddr, _netmask_query, nthhost, next_nth_usable, ipsubnet,
E ImportError: cannot import name network_in_network
!!! Interrupted: 1 errors during collection !!!
=========================================================================== 1 error in 0.21 seconds ============================================================================
mzhukovskiy@mzhukovs:~/learn/learn_python/ansible$
Thank you,
Mike