Skip to content

Rely on pytest-home for the alternate home directory.#4072

Merged
jaraco merged 2 commits into
mainfrom
feature/pytest-home
Jan 24, 2024
Merged

Rely on pytest-home for the alternate home directory.#4072
jaraco merged 2 commits into
mainfrom
feature/pytest-home

Conversation

@jaraco

@jaraco jaraco commented Oct 3, 2023

Copy link
Copy Markdown
Member

Summary of changes

Closes

Pull Request Checklist

@jaraco

jaraco commented Oct 3, 2023

Copy link
Copy Markdown
Member Author

I also tried applying the change to test_easy_install with:

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index d71e0158..b8a066b8 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -1394,7 +1394,9 @@ def test_use_correct_python_version_string(tmpdir, tmpdir_cwd, monkeypatch):
     assert cmd.config_vars['py_version_nodot'] == '310'
 
 
-def test_editable_user_and_build_isolation(setup_context, monkeypatch, tmp_path):
+def test_editable_user_and_build_isolation(
+    setup_context, monkeypatch, tmp_path, alt_home
+):
     '''`setup.py develop` should honor `--user` even under build isolation'''
 
     # == Arrange ==
@@ -1420,9 +1422,7 @@ def test_editable_user_and_build_isolation(setup_context, monkeypatch, tmp_path)
     #
     # 2. We are going to force `site` to update site.USER_BASE and site.USER_SITE
     #    To point inside our new home
-    monkeypatch.setenv('HOME', str(tmp_path / '.home'))
-    monkeypatch.setenv('USERPROFILE', str(tmp_path / '.home'))
-    monkeypatch.setenv('APPDATA', str(tmp_path / '.home'))
+    monkeypatch.setenv('APPDATA', str(alt_home))
     monkeypatch.setattr('site.USER_BASE', None)
     monkeypatch.setattr('site.USER_SITE', None)
     user_site = Path(site.getusersitepackages())

But when I did, the tests fail with a Sandbox violation. It seems the existing test is relying on the fact that the setup script is in $temp and that the home dir is a subdir of $temp, but if that expectation isn't true, the test fails. It may be worth investigating that strange expectation, but I'm not planning to do that.

@jaraco jaraco force-pushed the feature/pytest-home branch 3 times, most recently from d43776d to 0a5d8da Compare October 5, 2023 19:37
@jaraco jaraco closed this Jan 24, 2024
@jaraco jaraco reopened this Jan 24, 2024
@jaraco jaraco force-pushed the feature/pytest-home branch from 0a5d8da to 5c71837 Compare January 24, 2024 16:31
@jaraco jaraco merged commit b271996 into main Jan 24, 2024
@jaraco jaraco deleted the feature/pytest-home branch January 24, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant