◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
76 changes: 38 additions & 38 deletions test/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import ast
import os
import subprocess

Expand All @@ -11,50 +12,22 @@
class TestInstallation(TestBase):
@with_rw_directory
def test_installation(self, rw_dir):
venv = self._set_up_venv(rw_dir)

result = subprocess.run(
[venv.pip, "install", "."],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
self.assertEqual(
0,
result.returncode,
msg=result.stderr or result.stdout or "Can't install project",
)

result = subprocess.run(
[venv.python, "-c", "import git"],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
self.assertEqual(
0,
result.returncode,
msg=result.stderr or result.stdout or "Self-test failed",
)

result = subprocess.run(
[venv.python, "-c", "import gitdb; import smmap"],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
self.assertEqual(
0,
result.returncode,
msg=result.stderr or result.stdout or "Dependencies not installed",
)

# Even IF gitdb or any other dependency is supplied during development by
# inserting its location into PYTHONPATH or otherwise patched into sys.path,
# make sure it is not wrongly inserted as the *first* entry.
result = subprocess.run(
[venv.python, "-c", "import sys; import git; print(sys.path)"],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
syspath = result.stdout.decode("utf-8").splitlines()[0]
syspath = ast.literal_eval(syspath)
self.assertEqual(
"",
Expand All @@ -64,10 +37,37 @@ def test_installation(self, rw_dir):

@staticmethod
def _set_up_venv(rw_dir):
venv = VirtualEnvironment(rw_dir, with_pip=True)
os.symlink(
os.path.dirname(os.path.dirname(__file__)),
venv.sources,
target_is_directory=True,
)
return venv
Loading
Toggle all file notes Toggle all file annotations