Ansible ERROR: Command “pytest -r a –color yes –junit-xml test/results/junit/python2.7-units.xml -v test/units/” returned exit status 1.

When trying to run the tests against the Ansible source I got this error

[root@centos02 ansible]# make tests
test/runner/ansible-test units -v --python 2.7
Unit test with Python 2.7
Run command: pytest -r a --color yes --junit-xml test/results/junit/python2.7-units.xml -v test/units/
Traceback (most recent call last):
  File "/opt/ansible/test/runner/injector/pytest", line 184, in 
    main()
  File "/opt/ansible/test/runner/injector/pytest", line 26, in main
    handler = logging.FileHandler(os.path.abspath(os.path.join(self_dir, '..', 'logs', log_name)))
  File "/usr/lib64/python2.7/logging/__init__.py", line 902, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib64/python2.7/logging/__init__.py", line 925, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 2] No such file or directory: '/opt/ansible/test/runner/logs/ansible-test-coverage.root.log'
ERROR: Command "pytest -r a --color yes --junit-xml test/results/junit/python2.7-units.xml -v test/units/" returned exit status 1.

I had to manually create the directory it was looking for

mkdir -p /opt/ansible/test/runner/logs/
touch /opt/ansible/test/runner/logs/ansible-test-coverage.root.log

Be the first to comment

Leave a Reply