Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commite0b10d9

Browse files
test: add installation test
which installs the current codebase in a venvand runs 'import git' to test if codebase can beinstalled properly.This adds virtualenv to the test requirementsSigned-off-by: Konrad Weihmann <kweihmann@outlook.com>
1 parent961539c commite0b10d9

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎test-requirements.txt

Lines 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

‎test/test_installation.py

Lines 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+
importos
5+
importsubprocess
6+
fromtest.libimportTestBase
7+
fromtest.lib.helperimportwith_rw_directory
8+
9+
10+
classTestInstallation(TestBase):
11+
defsetUp_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+
deftest_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.stderrorresult.stdoutor"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.stderrorresult.stdoutor"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.stderrorresult.stdoutor"Selftest failed")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp