Issue 1:
(Original issue below the line)

As suggested below, it makes sense to make texcache private, which need to go through a deprecation cycle. See https://matplotlib.org/stable/devel/contributing.html#api-changes for a more detailed description of what is required in terms of deprecating something. Also, see the helper function deprecate_privatize_attribute and how it is used in the code base.

Marking as good first issue since there is a minor, well-defined, change. But it may require a bit of reading up to get it right.

Documentation Link

https://matplotlib.org/stable/api/texmanager_api.html

Problem

texcache = '/home/elliott/.cache/matplotlib/tex.cache'

Suggested improvement

Not a big deal, but maybe one can at least add a doc-string stating that is points to $HOME/.cache/matplotlib/tex.cache or however it is actually determined.

Issue 2:
Looks like matplotlib is completely not ready to use pytest which is very useful specially after installing some pytest extensions which passes code over many scanners and sanity checks allowing automatically find places in the code which could be fixed/improved.

How to reproduce that:

"python setuup.py build"

"python setuup.py install --root </install/prefix>"

execute "pytest" with PYTHONPATH pointing to python sitearchg and sitelib inside </install/prefix>

+ PATH=/home/tkloczko/rpmbuild/BUILDROOT/python-matplotlib-3.4.2-2.fc35.x86_64/usr/bin:/usr/bin:/usr/sbin:/usr/local/sbin
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-matplotlib-3.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-matplotlib-3.4.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ PYTHONDONTWRITEBYTECODE=1
+ xvfb-run -a -s '-screen 0 640x480x24' /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/tkloczko/rpmbuild/BUILD/matplotlib-3.4.2, configfile: pytest.ini, testpaths: lib
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, Faker-8.4.0, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0
collected 0 items / 1 error

================================================================================== ERRORS ==================================================================================
______________________________________________________________________ ERROR collecting test session _______________________________________________________________________
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:671: in _load_unlocked
???
<frozen importlib._bootstrap_external>:783: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
lib/matplotlib/__init__.py:107: in <module>
from . import _api, cbook, docstring, rcsetup
lib/matplotlib/cbook/__init__.py:31: in <module>
from matplotlib import _api, _c_internal_utils
E ImportError: cannot import name '_c_internal_utils' from partially initialized module 'matplotlib' (most likely due to a circular import) (/home/tkloczko/rpmbuild/BUILD/matplotlib-3.4.2/lib/matplotlib/__init__.py)
========================================================================= short test summary info ==========================================================================
ERROR - ImportError: cannot import name '_c_internal_utils' from partially initialized module 'matplotlib' (most likely due to a circular import) (/home/tkloczko/rpmbui...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.46s =============================================================================