Comments (6)
Hello @vincentbernat
Please refer to this link for unit test related commands. @samccann should be able to provide more information.
from ansible.netcommon.
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.
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.
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.
Thanks to you both. Both your methods work fine for me!
from ansible.netcommon.
I'm going to take that as this issue is solved.
from ansible.netcommon.
Related Issues (20)
- net_put for uploading files on routerOS HOT 4
- Broadcast messages cause cli_command to timeout. HOT 2
- ansible-lint CI dependency is broken HOT 1
- Integrating Commit Comment Support for Nokia SROS Devices in Ansible's netcommon Module HOT 4
- Add in diff on resource_module for result
- `result` keyword usage in Conditional class in parsing.py
- ansible.netcommon.netconf_config delete not working and missing example in documentation HOT 1
- Ansible Connection gets stuck when using VS Code Debugger HOT 3
- ansible.netcommon.cli_command module should consider the task successful if launched command succeed to execute even though the output includes error keyword. HOT 1
- Ansible copying Cisco Bin File locally/remotely at the same time HOT 4
- Config failure when non-unique iosxr configuration lines are uploaded.
- "Unmarshallable object" exception while used with dynamic inventories
- Add CR line ending support to telnet
- Saving config to startup should always be from running configuration.
- socket path does not exist or cannot be found HOT 4
- Typo in Documentation for telnet module parameters
- Merged #635 Causing Downstream issue in Collection cisco.ios HOT 5
- Variables inventory_hostname, remote_user don't contain the correct value HOT 6
- Add support to prettify xml with netconf_config before making diff HOT 1
- File "/tmp/ansible_fortios_monitor_fact_payload_v68501bf/ansible_fortios_monitor_fact_payload.zip/ansible/module_utils/connection.py", line 199, in __rpc__ ansible.module_utils.connection.ConnectionError: Requested entry (plugin_type: connection plugin: ansible_collections.ansible.netcommon.plugins.connection.httpapi setting: access_token ) was not defined in configuration.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible.netcommon.