Giter Club home page Giter Club logo

Comments (6)

GomathiselviS avatar GomathiselviS commented on August 22, 2024

Hello @vincentbernat

Please refer to this link for unit test related commands. @samccann should be able to provide more information.

from ansible.netcommon.

vincentbernat avatar vincentbernat commented on August 22, 2024

This guide doesn't work for out of trees module. Notably, ansible-test units --tox error out saying --tox is not recognized:

usage: ansible-test [-h] COMMAND ...
ansible-test: error: unrecognized arguments: --tox

The best I am able to do is manually enter the venv created by tox and then use ansible-test from here. However, for some reason, it tries to use all the wrong Python interpreters (I have 3.8 installed on my system):

WARNING: Skipping unit tests on Python 2.6 due to missing interpreter.
WARNING: Skipping unit tests on Python 3.5 due to missing interpreter.
WARNING: Skipping unit tests on Python 3.6 due to missing interpreter.
WARNING: Skipping unit tests on Python 3.7 due to missing interpreter.
WARNING: PyYAML is not installed for interpreter: /usr/bin/python2.7
Unit test with Python 2.7
/tmp/python-a0j2tp9_-ansible/python: No module named pytest
ERROR: Command "pytest --boxed -r a -n auto --color yes -p no:cacheprovider -c /home/bernat/code/blade/ansible_collections/ansible/netcommon/.tox/venv/lib/python3.8/site-packages/ansible_test/_data/pytest.ini --junit-xml /home/bernat/code/blade/ansible_collections/ansible/netcommon/tests/output/junit/python2.7-units.xml --strict-markers tests/unit/module_utils/network/common/test_config.py tests/unit/module_utils/network/common/test_parsing.py tests/unit/module_utils/network/common/test_utils.py tests/unit/modules/network/cli/test_cli_config.py tests/unit/plugins/connection/test_libssh.py tests/unit/plugins/connection/test_netconf.py tests/unit/plugins/connection/test_network_cli.py tests/unit/plugins/filter/test_ipaddr.py tests/unit/plugins/filter/test_network.py" returned exit status 1.

from ansible.netcommon.

felixfontein avatar felixfontein commented on August 22, 2024

Check out https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#testing-collections, it describes testing in the collection world. Best to simply run ansible-test units --docker -v, or for example ansible-test units --docker -v --python 3.5 to restrict to Python 3.5.

from ansible.netcommon.

gundalow avatar gundalow commented on August 22, 2024

Hi,
This is a good point, we do need some basic common how to get started with testing

Assuming you have Python 3.7 installed

mkdir -p ansible_collections/ansible
cd ansible_collections/ansible
git clone https://github.com/ansible-collections/ansible.netcommon netcommon
cd netcommon
ansible-test units --venv --python 3.7

from ansible.netcommon.

vincentbernat avatar vincentbernat commented on August 22, 2024

Thanks to you both. Both your methods work fine for me!

from ansible.netcommon.

Qalthos avatar Qalthos commented on August 22, 2024

I'm going to take that as this issue is solved.

from ansible.netcommon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.