Fail mercurialapi and qt_manifestmodel tests with python 3.11
While running Tortoisehg 6.2.x tests with Python 3.11 (for Gentoo Linux packaging) I encountered that mercurialapi
and qt_manifestmodel
tests are failed (see the tests log below).
The failures of tests/mercurialapi_test.py
tests are due to removing of getargspec
function from inspect
module (deprecated sinse Python 3.10). This seems could be fixed just by replacing getargspec
with getfullargspec
function that available since Pyhton 3.0 (or with signature
function - since Python 3.3). Both replacements solve the problem with mercurialapi
tests.
Sorry, I have no idea about quick fix 3 tests failures in tests/qt_manifestmodel_test.py
tests.
The failure tests log:
__________________________ test_same_argspec[_writenobuf-_writenobuf] ___________________
f = <function ui._writenobuf at 0x7fc3a8a047c0>, g = <function _extenduiclass.<locals>.pipeui._writenobuf at 0x7fc3a87b8860>
def test_same_argspec(f, g):
> fa, ga = inspect.getargspec(f), inspect.getargspec(g)
E AttributeError: module 'inspect' has no attribute 'getargspec'
tests/mercurialapi_test.py:8: AttributeError
_________________________________ test_same_argspec[getpass-getpass] ____________________
f = <function ui.getpass at 0x7fc3a8a05620>, g = <function _extenduiclass.<locals>.pipeui.getpass at 0x7fc3a87b8ea0>
def test_same_argspec(f, g):
> fa, ga = inspect.getargspec(f), inspect.getargspec(g)
E AttributeError: module 'inspect' has no attribute 'getargspec'
tests/mercurialapi_test.py:8: AttributeError
__________________________ test_same_argspec[label-label] ______________________________
f = <function ui.label at 0x7fc3a8a060c0>, g = <function _extenduiclass.<locals>.pipeui.label at 0x7fc3a87b9080>
def test_same_argspec(f, g):
> fa, ga = inspect.getargspec(f), inspect.getargspec(g)
E AttributeError: module 'inspect' has no attribute 'getargspec'
tests/mercurialapi_test.py:8: AttributeError
_________________________ test_same_argspec[makeprogress-makeprogress] __________________
f = <function ui.makeprogress at 0x7fc3a8a05e40>, g = <function _extenduiclass.<locals>.pipeui.makeprogress at 0x7fc3a87b8fe0>
def test_same_argspec(f, g):
> fa, ga = inspect.getargspec(f), inspect.getargspec(g)
E AttributeError: module 'inspect' has no attribute 'getargspec'
tests/mercurialapi_test.py:8: AttributeError
_________________________ test_same_argspec[prompt-prompt] ________________________________
f = <function ui.prompt at 0x7fc3a8a053a0>, g = <function _extenduiclass.<locals>.pipeui.prompt at 0x7fc3a87b87c0>
def test_same_argspec(f, g):
> fa, ga = inspect.getargspec(f), inspect.getargspec(g)
E AttributeError: module 'inspect' has no attribute 'getargspec'
tests/mercurialapi_test.py:8: AttributeError
______________________ test_same_argspec[promptchoice-promptchoice] _______________________
f = <function ui.promptchoice at 0x7fc3a8a05580>, g = <function _extenduiclass.<locals>.pipeui.promptchoice at 0x7fc3a87b8e00>
def test_same_argspec(f, g):
> fa, ga = inspect.getargspec(f), inspect.getargspec(g)
E AttributeError: module 'inspect' has no attribute 'getargspec'
tests/mercurialapi_test.py:8: AttributeError
______________________ ManifestModelTest.test_name_filter ________________________
self = <qt_manifestmodel_test.ManifestModelTest testMethod=test_name_filter>
def test_name_filter(self):
m = self.new_model(0)
m.setNameFilter('ax')
self.assertFalse(m.indexFromPath('bar').isValid())
> self.assertTrue(m.indexFromPath('baz/bax').isValid())
E AssertionError: False is not true
tests/qt_manifestmodel_test.py:383: AssertionError
_______________________ ManifestModelTest.test_name_filter_empty_subrepo __________
self = <qt_manifestmodel_test.ManifestModelTest testMethod=test_name_filter_empty_subrepo>
def test_name_filter_empty_subrepo(self):
m = self.new_model(2)
m.setNameFilter('sub')
> self.assertTrue(m.indexFromPath('sub').isValid())
E AssertionError: False is not true
tests/qt_manifestmodel_test.py:421: AssertionError
____________________________ ManifestModelPatchTest.test_name_filter _____________________________
self = <qt_manifestmodel_test.ManifestModelPatchTest testMethod=test_name_filter>
def test_name_filter(self):
m = self.new_model(b'patch0.diff')
m.setNameFilter('bar')
> self.assertEqual(['bar'], alldata(m))
E AssertionError: Lists differ: ['bar'] != []
E
E First list contains 1 additional elements.
E First extra element 0:
E 'bar'
E
E - ['bar']
E + []
tests/qt_manifestmodel_test.py:551: AssertionError