# testing python / ansible modules

**URL:** <https://forum.ansible.com/t/testing-python-ansible-modules/22369>\
**Category:** Ansible Project\
**Created:** [August 24, 2016, 2:05pm UTC](https://forum.ansible.com/t/testing-python-ansible-modules/22369 "2016-08-24T14:05:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Leonhardt](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Alex\_Leonhardt](https://forum.ansible.com/u/Alex_Leonhardt)\
**Post date:** [August 24, 2016, 2:05pm UTC](https://forum.ansible.com/t/testing-python-ansible-modules/22369/1 "2016-08-24T14:05:23Z")

</div>

Hi All,

I was wondering if anyone ever wrote tests for an ansible module ?

I’m trying to instantiate m = AnsibleModule(argument\_spec=dict()) but it keeps failing with “Error: Module unable to decode valid JSON on stdin.”, before I can even call m.params = {} or something to give the instance some parameters to work with. To me it seems you’re currently unable to specify / override parameters passed to a AnsibleModule directly, is there something I can do to give AnsibleModule the correct context to find these parameters ?

Thanks!

Alex
