Source

pip-patches / custom-userbase

# HG changeset patch
# Parent 0502ad712448e51a759d665258330b6cca306355
use a cusom PYTHONUSERBASE for testing --user

diff --git a/tests/test_basic.py b/tests/test_basic.py
--- a/tests/test_basic.py
+++ b/tests/test_basic.py
@@ -277,6 +277,17 @@ def test_install_curdir():
     assert fspkg_folder in result.files_created, str(result.stdout)
     assert egg_info_folder in result.files_created, str(result)
 
+def test_install_curdir_usersite():
+    """
+    Test installing current directory ('.') into usersite
+    """
+    env = reset_env()
+    run_from = abspath(join(here, 'packages', 'FSPkg'))
+    result = run_pip('install', '--user', curdir, cwd=run_from, expect_error=False)
+    fspkg_folder = env.site_packages/'fspkg'
+    egg_info_folder = env.user_site/'FSPkg-0.1dev-py%s.egg-info' % pyversion
+    assert fspkg_folder in result.files_created, str(result.stdout)
+    assert egg_info_folder in result.files_created, str(result)
 
 def test_install_pardir():
     """
diff --git a/tests/test_pip.py b/tests/test_pip.py
--- a/tests/test_pip.py
+++ b/tests/test_pip.py
@@ -289,6 +289,11 @@ class TestPipEnvironment(TestFileEnviron
         assert self.venv == TestPipEnvironment.venv # sanity check
 
         self.site_packages = self.lib/'site-packages'
+        self.user_base_path = self.venv_path/'user'
+        self.user_site_path = self.venv_path/'user'/self.lib.name/'site-packages'
+        self.user_site = relpath(self.root_path, self.user_site_path)
+        demand_dirs(self.user_base_path)
+        self.environ["PYTHONUSERBASE"] = self.user_base_path
 
         # put the test-scratch virtualenv's bin dir first on the PATH
         self.environ['PATH'] = Path.pathsep.join((self.bin_path, self.environ['PATH']))