Skip to content

Commit dad9161

Browse files
authored
Fix error with test_easy_install (#3245)
2 parents fd632df + ec62173 commit dad9161

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

setuptools/tests/test_easy_install.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1184,16 +1184,23 @@ def test_editable_user_and_build_isolation(setup_context, monkeypatch, tmp_path)
11841184
# it will `makedirs("/home/user/.pyenv/versions/3.9.10 /home/user/.pyenv/versions/3.9.10/lib /home/user/.pyenv/versions/3.9.10/lib/python3.9 /home/user/.pyenv/versions/3.9.10/lib/python3.9/lib-dynload")`` # noqa: E501
11851185
# 2. We are going to force `site` to update site.USER_BASE and site.USER_SITE
11861186
# To point inside our new home
1187-
monkeypatch.setenv('HOME', str(tmp_path / 'home'))
1187+
monkeypatch.setenv('HOME', str(tmp_path / '.home'))
1188+
monkeypatch.setenv('USERPROFILE', str(tmp_path / '.home'))
1189+
monkeypatch.setenv('APPDATA', str(tmp_path / '.home'))
11881190
monkeypatch.setattr('site.USER_BASE', None)
11891191
monkeypatch.setattr('site.USER_SITE', None)
11901192
user_site = Path(site.getusersitepackages())
11911193
user_site.mkdir(parents=True, exist_ok=True)
11921194

1193-
sys_prefix = (tmp_path / 'sys_prefix')
1195+
sys_prefix = (tmp_path / '.sys_prefix')
11941196
sys_prefix.mkdir(parents=True, exist_ok=True)
11951197
monkeypatch.setattr('sys.prefix', str(sys_prefix))
11961198

1199+
setup_script = (
1200+
"__import__('setuptools').setup(name='aproj', version=42, packages=[])\n"
1201+
)
1202+
(tmp_path / "setup.py").write_text(setup_script, encoding="utf-8")
1203+
11971204
# == Sanity check ==
11981205
assert list(sys_prefix.glob("*")) == []
11991206
assert list(user_site.glob("*")) == []
@@ -1208,4 +1215,4 @@ def test_editable_user_and_build_isolation(setup_context, monkeypatch, tmp_path)
12081215
installed = {f.name for f in user_site.glob("*")}
12091216
# sometimes easy-install.pth is created and sometimes not
12101217
installed = installed - {"easy-install.pth"}
1211-
assert installed == {'UNKNOWN.egg-link'}
1218+
assert installed == {'aproj.egg-link'}

0 commit comments

Comments
 (0)