Running tests shows AttributeError: type object 'Axis' has no attribute '_set_ticklabels'

I am running the provided tests (for example, pytest lib/matplotlib/tests/test_dates.py) on my matplotlib fork and in my dev environment. This shows ERROR lib/matplotlib/tests/test_dates.py - AttributeError: type object 'Axis' has no attribute '_set_ticklabels' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !

I’ve tried reinstalling matplotlib. How can this error be resolved? Thank you!