web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
4.86k stars 3.03k forks source link

python3.9 support in resources/tests? #28692

Closed ArthurSonzogni closed 3 years ago

ArthurSonzogni commented 3 years ago

(PS: I have very little knowledge about python)

I have issues running the internal tests from: resources/tests.

I was using python2.7 and it was working fine. Then incompatibles changes were introduced and then support for py27 removed.

tox is now configured to run on py36 and py38 only. However on glinux, I get the error:

ERROR: invocation failed (exit code 1), logfile: /home/arthursonzogni/programmation/real/wpt/resources/test/.tox/py38/log/py38-0.log
============================================================= log start =============================================================
RuntimeError: failed to query /usr/bin/python3.8 with code 1 err: 'Traceback (most recent call last):\n  File "/usr/local/lib/python3.9/dist-packages/virtualenv/discovery/py_info.py", line 16, in <module>\n    from distutils import dist\nImportError: cannot import name \'dist\' from \'distutils\' (/usr/lib/python3.8/distutils/__init__.py)\n'

This is because glinux moved from python 3.8 toward python 3.9 (recently ~3 weeks ago). You can still install python3.8 but the package python3-distutils for 3.9 is now breaking 3.8.

See: https://yaqs.corp.google.com/eng/q/1466141581034651648 See: https://yaqs.corp.google.com/eng/q/5091265084522496

As a result, it is not possible on glinux to run WPT internal tests anymore.

Maybe we should add support for py39? This would fix the problem. I tried running tox with py39, but this doesn't work as-is, due to a deprecated function in 3.2 removed in3.9 https://github.com/jbarlow83/OCRmyPDF/issues/583

conftest.py:115: in __init__
    for element in parsed.getiterator():
E   AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

cc @web-platform-tests/wpt-core-team

foolip commented 3 years ago

@jgraham how do you think we should deal Python 3.9? Should we add it to the various tox.ini so that it can be tested locally? Should we also use 3.9 in CI by default, relegating 3.8 to the same untested-but-probably-working status as 3.7?

jgraham commented 3 years ago

https://github.com/web-platform-tests/wpt/pull/28713 perhaps?

foolip commented 3 years ago

Thanks @ArthurSonzogni for digging into that error. Looks like for element in parsed.iter() should be the fix if the docs are correct. I'll try that in https://github.com/web-platform-tests/wpt/pull/28713.

ArthurSonzogni commented 3 years ago

Thanks @foolip !

This can be closed, fixed by: https://github.com/web-platform-tests/wpt/commit/ebc9eba1663d7c556cf82b8275fb52b527a78f67