diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 7b7815ab89..29aace13ef 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -3,6 +3,7 @@ import sys import os import distutils.errors +import platform from setuptools.extern import six from setuptools.extern.six.moves import urllib, http_client @@ -285,7 +286,13 @@ def test_report(self): @pytest.fixture def temp_home(tmpdir, monkeypatch): - monkeypatch.setitem(os.environ, 'HOME', str(tmpdir)) + key = ( + 'USERPROFILE' + if platform.system() == 'Windows' and sys.version_info > (3, 8) else + 'HOME' + ) + + monkeypatch.setitem(os.environ, key, str(tmpdir)) return tmpdir