Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0b10d9

Browse filesBrowse files
test: add installation test
which installs the current codebase in a venv and runs 'import git' to test if codebase can be installed properly. This adds virtualenv to the test requirements Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
1 parent 961539c commit e0b10d9
Copy full SHA for e0b10d9

2 files changed

+30Lines changed: 30 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test-requirements.txt‎

Copy file name to clipboardExpand all lines: test-requirements.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ ddt>=1.1.1
22
coverage
33
flake8
44
tox
5+
virtualenv
Collapse file

‎test/test_installation.py‎

Copy file name to clipboard
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This module is part of GitPython and is released under
2+
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
3+
4+
import os
5+
import subprocess
6+
from test.lib import TestBase
7+
from test.lib.helper import with_rw_directory
8+
9+
10+
class TestInstallation(TestBase):
11+
def setUp_venv(self, rw_dir):
12+
self.venv = rw_dir
13+
subprocess.run(['virtualenv', self.venv], stdout=subprocess.PIPE)
14+
self.python = os.path.join(self.venv, 'bin/python3')
15+
self.pip = os.path.join(self.venv, 'bin/pip3')
16+
self.sources = os.path.join(self.venv, "src")
17+
self.cwd = os.path.dirname(os.path.dirname(__file__))
18+
os.symlink(self.cwd, self.sources, target_is_directory=True)
19+
20+
@with_rw_directory
21+
def test_installation(self, rw_dir):
22+
self.setUp_venv(rw_dir)
23+
result = subprocess.run([self.pip, 'install', '-r', 'requirements.txt'],
24+
stdout=subprocess.PIPE, cwd=self.sources)
25+
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Can't install requirements")
26+
result = subprocess.run([self.python, 'setup.py', 'install'], stdout=subprocess.PIPE, cwd=self.sources)
27+
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Can't build - setup.py failed")
28+
result = subprocess.run([self.python, '-c', 'import git'], stdout=subprocess.PIPE, cwd=self.sources)
29+
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Selftest failed")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.