py38 unit test failure - test_validate_patternProperties_fails

Bug #1855493 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Stephen Finucane

Bug Description

{0} nova.tests.unit.test_api_validation.PatternPropertiesTestCase.test_validate_patternProperties_fails [0.132395s] ... FAILED

Captured traceback:
~~~~~~~~~~~~~~~~~~~ b'Traceback (most recent call last):'
    b' File "/home/corey/pkg/ussuri/upstream/nova/nova/api/validation/validators.py", line 280, in validate'
    b' self.validator.validate(*args, **kwargs)'
    b' File "/home/corey/pkg/ussuri/upstream/nova/.tox/py38/lib/python3.8/site-packages/jsonschema/validators.py", line 352, in validate'
    b' for error in self.iter_errors(*args, **kwargs):'
    b' File "/home/corey/pkg/ussuri/upstream/nova/.tox/py38/lib/python3.8/site-packages/jsonschema/validators.py", line 328, in iter_errors'
    b' for error in errors:'
    b' File "/home/corey/pkg/ussuri/upstream/nova/.tox/py38/lib/python3.8/site-packages/jsonschema/_validators.py", line 22, in patternProperties'
    b' if re.search(pattern, k):'
    b' File "/home/corey/pkg/ussuri/upstream/nova/.tox/py38/lib/python3.8/re.py", line 199, in search'
    b' return _compile(pattern, flags).search(string)'
    b'TypeError: expected string or bytes-like object'
    b''
    b'During handling of the above exception, another exception occurred:'
    b''
    b'Traceback (most recent call last):'
    b' File "/home/corey/pkg/ussuri/upstream/nova/nova/tests/unit/test_api_validation.py", line 145, in check_validation_error'
    b' method(body=body, req=req)'
    b' File "/home/corey/pkg/ussuri/upstream/nova/nova/api/validation/__init__.py", line 107, in wrapper'
    b" _schema_validation_helper(request_body_schema, kwargs['body'],"
    b' File "/home/corey/pkg/ussuri/upstream/nova/nova/api/validation/__init__.py", line 88, in _schema_validation_helper'
    b' schema_validator.validate(target)'
    b' File "/home/corey/pkg/ussuri/upstream/nova/nova/api/validation/validators.py", line 314, in validate'
    b' raise exception.ValidationError(detail=detail)'
    b'nova.exception.ValidationError: expected string or bytes-like object'
    b''
    b'During handling of the above exception, another exception occurred:'
    b''
    b'Traceback (most recent call last):'
    b' File "/home/corey/pkg/ussuri/upstream/nova/nova/tests/unit/test_api_validation.py", line 451, in test_validate_patternProperties_fails'
    b" self.check_validation_error(self.post, body={None: 'bar'},"
    b' File "/home/corey/pkg/ussuri/upstream/nova/nova/tests/unit/test_api_validation.py", line 152, in check_validation_error'
    b" self.assertEqual(expected_detail, ex.kwargs['detail'],"
    b' File "/home/corey/pkg/ussuri/upstream/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 411, in assertEqual'
    b' self.assertThat(observed, matcher, message)'
    b' File "/home/corey/pkg/ussuri/upstream/nova/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 498, in assertThat'
    b' raise mismatch_error'
    b"testtools.matchers._impl.MismatchError: 'expected string or buffer' != 'expected string or bytes-like object': Exception details did not match expected"
    b''

Tags: py38
Revision history for this message
Corey Bryant (corey.bryant) wrote :

The good news is it's the only py38 unit test failure I'm seeing for nova!

tags: added: py38
Revision history for this message
sean mooney (sean-k-mooney) wrote :

http://paste.openstack.org/show/787499/

so yes i can confim this is a thing

there are also some warning where "is" and "is not" are used for equality check
instead of identity checks that we should address in general.

i verifyed this on ubuntu 18.04 with py3.8 form the distro pacakges

ubuntu@dev:/opt/repos/nova-2$ apt show python3.8
Package: python3.8
Version: 3.8.0-3~18.04
Priority: optional
Section: universe/python
Origin: Ubuntu
Maintainer: Ubuntu Developers <email address hidden>
Original-Maintainer: Matthias Klose <email address hidden>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 488 kB
Depends: python3.8-minimal (= 3.8.0-3~18.04), libpython3.8-stdlib (= 3.8.0-3~18.04), mime-support
Suggests: python3.8-venv, python3.8-doc, binutils
Breaks: python3-all (<< 3.6.5~rc1-1), python3-dev (<< 3.6.5~rc1-1), python3-venv (<< 3.6.5-2)
Download-Size: 355 kB
APT-Manual-Installed: yes
APT-Sources: http://nova.clouds.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
Description: Interactive high-level object-oriented language (version 3.8)
 Python is a high-level, interactive, object-oriented language. Its 3.8 version
 includes an extensive class library with lots of goodies for
 network programming, system administration, sounds and graphics.

this kind of looks like a binary vs text string issue but i have not look at it closely yet

Changed in nova:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/698732

Changed in nova:
assignee: nobody → Stephen Finucane (stephenfinucane)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/698732
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0378c2c780998e7bbba0f2f4f3db281e68f8d981
Submitter: Zuul
Branch: master

commit 0378c2c780998e7bbba0f2f4f3db281e68f8d981
Author: Stephen Finucane <email address hidden>
Date: Thu Dec 12 15:00:07 2019 +0000

    Don't hardcode Python versions in test

    As noted in change If8184c190e76d8cefb5b097f8fa8cb7564207103, the format
    of an internal error message changed in Python 3. There's no need to
    manually list each of these versions though - just ensure it's Python 3.

    Change-Id: Ie1a97d251c6098054bdc963acf53c3182b52b2aa
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1855493

Changed in nova:
status: In Progress → Fix Released
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.