# Advice wanted for failing ansible-test sanity checks for contributed modules

**URL:** <https://forum.ansible.com/t/advice-wanted-for-failing-ansible-test-sanity-checks-for-contributed-modules/27984>\
**Category:** Ansible Developer\
**Created:** [July 8, 2018, 11:22am UTC](https://forum.ansible.com/t/advice-wanted-for-failing-ansible-test-sanity-checks-for-contributed-modules/27984 "2018-07-08T11:22:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhysmeister](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rhysmeister/32/10599_2.png) [@rhysmeister](https://forum.ansible.com/u/rhysmeister)\
**Post date:** [July 8, 2018, 11:22am UTC](https://forum.ansible.com/t/advice-wanted-for-failing-ansible-test-sanity-checks-for-contributed-modules/27984/1 "2018-07-08T11:22:48Z")

</div>

Hello All,

I have submitted a PR for two new modules for mongodb. These were based on the existing mongodb modules and thus I re-used some of code. The PR is failing on two ansible-test sanity checks…

lib/ansible/modules/database/mongodb/mongodb\_replicaset.py:271:24: use argspec type=“path” instead of type=“str” to avoid use of `expanduser`  
lib/ansible/modules/database/mongodb/mongodb\_shard.py:215:24: use argspec type=“path” instead of type=“str” to avoid use of `expanduser`

This is from the following function…

`

| 

def load\_mongocnf():

 |
| | 

config = configparser.RawConfigParser()

 |
| | 

mongocnf = os.path.expanduser(‘~/.mongodb.cnf’)

 |
| | |
| | 

try:

 |
| | 

config.readfp(open(mongocnf))

 |
| | 

creds = dict(

 |
| | 

user=config.get(‘client’, ‘user’),

 |
| | 

password=config.get(‘client’, ‘pass’)

 |
| | 

)

 |
| | 

except (configparser.NoOptionError, IOError):

 |
| | 

return False

 |
| | |
| | 

return creds

 |

`

I don’t really think the suggestion here is appropriate as it’s not a user supplied value. This code is present as-is in the existing mongodb modules so I’m not sure I should take a different approach either. What would be the preferred course of action here?

The pull request is: [https://github.com/ansible/ansible/pull/41881](https://github.com/ansible/ansible/pull/41881)

Rhys
