This should work
$ ansible-test units --tox --python 2.7 
test/units/plugins/filter/test_ipaddr.py


On Tuesday, January 22, 2019 at 12:14:41 AM UTC+5:30, Mike Zhukovskiy wrote:
>
> 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 <module>
>     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
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to