Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New USD tests fail on Python 3.11 due to changed annotations #3384

Open
dgovil opened this issue Oct 29, 2024 · 2 comments
Open

New USD tests fail on Python 3.11 due to changed annotations #3384

dgovil opened this issue Oct 29, 2024 · 2 comments

Comments

@dgovil
Copy link
Collaborator

dgovil commented Oct 29, 2024

Description of Issue

We are noticing an issue with running some of the embedded Boost python tests when building USD for Python 3.11 (pxr/external/boost/python/test). These tests utilize doctest which executes a documentation block and compares the script output directly. Unfortunately, the output is not consistent between Python versions, so some of the tests fail on Python 3.11 (presumably the expected output was generated with 3.10 where we are seeing the tests pass).
Here is an example test that is failing:
https://github.com/PixarAnimationStudios/OpenUSD/blob/release/pxr/external/boost/python/test/properties.py

Failed example:
    x1.value_r = 2
Expected:
    Traceback (most recent call last):
      File "properties.py", line 49, in ?
        x1.value_r = 2
    AttributeError: can't set attribute
Got:
    Traceback (most recent call last):
      File ".../doctest.py", line 1355, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest __main__[16]>", line 1, in <module>
        x1.value_r = 2
        ^^^^^^^^^^
    AttributeError: property of 'X' object has no setter

The three tests we are seeing fail in Python 3.11 are:

  • python_properties
  • python_pickle1
  • python_pickle4

Python 3.11 had a lot of work done to make tracebacks more friendly to devs, so the tests don't apply to it the same way.

@jesschimein
Copy link
Contributor

Filed as internal issue #USD-10369

@sunyab
Copy link
Contributor

sunyab commented Oct 30, 2024

Thanks @dgovil! It looks like there are two issues here:

  • python_properties is failing due to the traceback differences in 3.11. Thankfully doctest has facilities for ignoring these differences.
  • I think python_pickle1 and python_pickle4 are failing because of the change to __getstate__ in 3.11 (see docs). That's causing __reduce__ to include an extra None value in the returned tuple. Functionally, I don't think this matters since the docs for reduce say that None is an acceptable value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants