tripleo-common unit tests fail on python3.6

Bug #1778903 reported by Alfredo Moralejo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Alex Schultz

Bug Description

When running unit tests in fedora with python3.6, following errors appear:

$ tox -epy36
py36 develop-inst-nodeps: /tmp/tripleo-common
py36 installed: alabaster==0.7.11,appdirs==1.4.3,asn1crypto==0.24.0,Babel==2.6.0,bcrypt==3.1.4,certifi==2018.4.16,cffi==1.11.5,chardet==3.0.4,cliff==2.12.1,cmd2==0.9.1,colorama==0.3.9,coverage==4.5.1,cryptography==2.2.2,debtcollector==1.19.0,decorator==4.3.0,deprecation==2.0.4,docker==3.4.0,docker-pycreds==0.3.0,docutils==0.14,dogpile.cache==0.6.5,dulwich==0.19.4,extras==1.0.0,fasteners==0.14.1,fixtures==3.0.0,flake8==2.5.5,gitdb2==2.0.3,GitPython==2.1.10,hacking==0.12.0,idna==2.7,imagesize==1.0.0,iso8601==0.1.12,Jinja2==2.10,jmespath==0.9.3,jsonpatch==1.23,jsonpointer==2.0,jsonschema==2.6.0,keystoneauth1==3.9.0,linecache2==1.0.0,MarkupSafe==1.0,mccabe==0.2.1,mistral-lib==0.5.0,mock==2.0.0,monotonic==1.5,mox3==0.25.0,msgpack==0.5.6,munch==2.3.2,netaddr==0.7.19,netifaces==0.10.7,openstackdocstheme==1.21.0,openstacksdk==0.14.0,os-client-config==1.31.2,os-service-types==1.2.0,osc-lib==1.10.0,oslo.concurrency==3.27.0,oslo.config==6.2.1,oslo.context==2.21.0,oslo.i18n==3.20.0,oslo.log==3.38.1,oslo.serialization==2.27.0,oslo.utils==3.36.3,oslotest==3.5.0,packaging==17.1,paramiko==2.4.1,passlib==1.7.1,pbr==4.0.4,pep8==1.5.7,prettytable==0.7.2,pyasn1==0.4.3,pycparser==2.18,pyflakes==0.8.1,Pygments==2.2.0,pyinotify==0.9.6,PyNaCl==1.2.1,pyOpenSSL==18.0.0,pyparsing==2.2.0,pyperclip==1.6.2,python-dateutil==2.7.3,python-glanceclient==2.11.1,python-heatclient==1.16.0,python-ironic-inspector-client==3.2.0,python-ironicclient==2.4.0,python-keystoneclient==3.17.0,python-mimeparse==1.6.0,python-mistralclient==3.6.0,python-novaclient==10.3.0,python-subunit==1.3.0,python-swiftclient==3.5.0,python-zaqarclient==1.9.0,pytz==2018.4,PyYAML==3.12,reno==2.9.2,requests==2.19.1,requestsexceptions==1.4.0,rfc3986==1.1.0,simplejson==3.15.0,six==1.11.0,smmap2==2.0.3,snowballstemmer==1.2.1,Sphinx==1.7.5,sphinxcontrib-websupport==1.1.0,stevedore==1.28.0,tenacity==4.12.0,testrepository==0.0.20,testscenarios==0.5.0,testtools==2.3.0,traceback2==1.4.0,-e git+http://github.com/openstack/tripleo-common@33e8979c7f96689992322171dd97a6d6636236cc#egg=tripleo_common,unittest2==1.1.0,urllib3==1.23,warlock==1.3.0,wcwidth==0.1.7,websocket-client==0.48.0,wrapt==1.10.11
py36 runtests: PYTHONHASHSEED='442003222'
py36 runtests: commands[0] | python setup.py test --slowest --testr-args=
running test
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . --list
/tmp/tripleo-common/.tox/py36/lib/python3.6/site-packages/testtools/run.py:192: ResourceWarning: unclosed file <_io.FileIO name=1 mode='wb' closefd=True>
  runner.list(self.test, loader=self.testLoader)
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=1 encoding='UTF-8'>
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . --load-list /tmp/tmp9rqvbwek
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . --load-list /tmp/tmp8czzuji5
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . --load-list /tmp/tmp9wskr74q
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . --load-list /tmp/tmpg1zv3jm4
======================================================================
FAIL: tripleo_common.tests.actions.test_deployment.DeploymentFailuresActionTest.test_get_deployment_failures
tags: worker-0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tripleo-common/.tox/py36/lib/python3.6/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/tmp/tripleo-common/tripleo_common/tests/actions/test_deployment.py", line 524, in test_get_deployment_failures
    result = action.run(self.ctx)
  File "/tmp/tripleo-common/tripleo_common/actions/deployment.py", line 337, in run
    self.ansible_errors_file)
  File "/tmp/tripleo-common/.tox/py36/lib64/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/tmp/tripleo-common/.tox/py36/lib64/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'MagicMock'
======================================================================
FAIL: tripleo_common.tests.actions.test_deployment.DeploymentFailuresActionTest.test_get_deployment_failures_no_file
tags: worker-3
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tripleo-common/.tox/py36/lib/python3.6/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/tmp/tripleo-common/tripleo_common/tests/actions/test_deployment.py", line 573, in test_get_deployment_failures_no_file
    result = action.run(self.ctx)
  File "/tmp/tripleo-common/tripleo_common/actions/deployment.py", line 337, in run
    self.ansible_errors_file)
  File "/tmp/tripleo-common/.tox/py36/lib64/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/tmp/tripleo-common/.tox/py36/lib64/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'MagicMock'
======================================================================
FAIL: tripleo_common.tests.actions.test_config.DownloadConfigActionTest.test_run
tags: worker-1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tripleo-common/.tox/py36/lib/python3.6/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/tmp/tripleo-common/tripleo_common/tests/actions/test_config.py", line 122, in test_run
    action.run(self.ctx)
  File "/tmp/tripleo-common/tripleo_common/actions/config.py", line 87, in run
    os.path.dirname(self.work_dir), 'config-download-latest')
  File "/tmp/tripleo-common/.tox/py36/lib64/python3.6/posixpath.py", line 156, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not MagicMock
sys:1: ResourceWarning: unclosed file <_io.FileIO name=1 mode='wb' closefd=True>
sys:1: ResourceWarning: unclosed file <_io.FileIO name=1 mode='wb' closefd=True>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=1 encoding='UTF-8'>
sys:1: ResourceWarning: unclosed file <_io.FileIO name=1 mode='wb' closefd=True>
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/tmp1y7hp39u/tmpg976tml2'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=1 encoding='UTF-8'>
sys:1: ResourceWarning: unclosed file <_io.FileIO name=1 mode='wb' closefd=True>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=1 encoding='UTF-8'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=1 encoding='UTF-8'>
Ran 455 tests in 3.780s (-0.267s)
FAILED (id=3, failures=3)
error: testr failed (1)
ERROR: InvocationError: '/tmp/tripleo-common/.tox/py36/bin/python setup.py test --slowest --testr-args='
__________________________________________________________________________________________ summary ___________________________________________________________________________________________
ERROR: py36: commands failed

Changed in tripleo:
status: New → Triaged
importance: Undecided → Medium
milestone: none → rocky-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (master)

Fix proposed to branch: master
Review: https://review.openstack.org/578378

Changed in tripleo:
assignee: nobody → Alex Schultz (alex-schultz)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (master)

Reviewed: https://review.openstack.org/578378
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=7149253e619c9d9ded52c0953035eeb993e8cdc5
Submitter: Zuul
Branch: master

commit 7149253e619c9d9ded52c0953035eeb993e8cdc5
Author: Alex Schultz <email address hidden>
Date: Wed Jun 27 07:17:14 2018 -0600

    Fix unit tests under python 3.6

    Python 3.6 doesn't like it when you use join on a mock so we need to
    pass actual values in when testing.

    Change-Id: I028f7cd2934a5b70f70c3582487ec5580c1cb01f
    Closes-Bug: #1778903

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 9.2.0

This issue was fixed in the openstack/tripleo-common 9.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.