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

Commit3edd16c

Browse files
authored
Merge pull request#1031 from priv-kweihmann/move-test-2nd
[RFC/WIP] move tests and avoid packaging them
2 parents9cb7ae8 +e0b10d9 commit3edd16c

File tree

106 files changed

+97
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+97
-51
lines changed

‎.deepsource.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version =1
22

33
test_patterns = [
4-
'git/test/**/test_*.py'
4+
'test/**/test_*.py'
55
]
66

77
exclude_patterns = [

‎.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
git/test/fixtures/*eol=lf
1+
test/fixtures/*eol=lf
22
init-tests-after-clone.sh

‎.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
git config --global user.name "Travis Runner"
4141
# If we rewrite the user's config by accident, we will mess it up
4242
# and cause subsequent tests to fail
43-
catgit/test/fixtures/.gitconfig >> ~/.gitconfig
43+
cat test/fixtures/.gitconfig >> ~/.gitconfig
4444
-name:Lint with flake8
4545
run:|
4646
set -x

‎.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ script:
3636
# Make sure we limit open handles to see if we are leaking them
3737
-ulimit -n 128
3838
-ulimit -n
39-
-coverage run --omit="git/test/*" -m unittest --buffer
39+
-coverage run --omit="test/*" -m unittest --buffer
4040
-coverage report
4141
-if [ "$TRAVIS_PYTHON_VERSION" == '3.5' ]; then cd doc && make html; fi
4242
-if [ "$TRAVIS_PYTHON_VERSION" == '3.6' ]; then flake8 --ignore=W293,E265,E266,W503,W504,E731; fi

‎MANIFEST.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ include AUTHORS
55
include CONTRIBUTING.md
66
include README.md
77
include requirements.txt
8-
include test-requirements.txt
98

109
recursive-include doc *
11-
12-
graft git/test/fixtures
13-
graft git/test/performance
10+
recursive-exclude test *
1411

1512
global-exclude __pycache__ *.pyc

‎setup.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
fromdistutils.command.build_pyimportbuild_pyas_build_py
1111
fromsetuptools.command.sdistimportsdistas_sdist
12+
importfnmatch
1213
importos
1314
importsys
1415
fromosimportpath
@@ -66,6 +67,24 @@ def _stamp_version(filename):
6667
print("WARNING: Couldn't find version line in file %s"%filename,file=sys.stderr)
6768

6869

70+
defbuild_py_modules(basedir,excludes=[]):
71+
# create list of py_modules from tree
72+
res=set()
73+
_prefix=os.path.basename(basedir)
74+
forroot,_,filesinos.walk(basedir):
75+
forfinfiles:
76+
_f,_ext=os.path.splitext(f)
77+
if_extnotin [".py"]:
78+
continue
79+
_f=os.path.join(root,_f)
80+
_f=os.path.relpath(_f,basedir)
81+
_f="{}.{}".format(_prefix,_f.replace(os.sep,"."))
82+
ifany(fnmatch.fnmatch(_f,x)forxinexcludes):
83+
continue
84+
res.add(_f)
85+
returnlist(res)
86+
87+
6988
setup(
7089
name="GitPython",
7190
cmdclass={'build_py':build_py,'sdist':sdist},
@@ -74,9 +93,9 @@ def _stamp_version(filename):
7493
author="Sebastian Thiel, Michael Trier",
7594
author_email="byronimo@gmail.com, mtrier@gmail.com",
7695
url="https://github.com/gitpython-developers/GitPython",
77-
packages=find_packages('.'),
78-
py_modules=['git.'+f[:-3]forfinos.listdir('./git')iff.endswith('.py')],
79-
package_data={'git.test': ['fixtures/*']},
96+
packages=find_packages(exclude=("test.*")),
97+
include_package_data=True,
98+
py_modules=build_py_modules("./git",excludes=["git.ext.*"]),
8099
package_dir={'git':'git'},
81100
python_requires='>=3.4',
82101
install_requires=requirements,

‎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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎git/test/fixtures/diff_index_patchrenamed to‎test/fixtures/diff_index_patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,26 @@ index f2233fbf40f3f69309ce5cc714e99fcbdcd33ec3..a88a777df3909a61be97f1a7b1194dad
5656
@@ -1 +1 @@
5757
-Subproject commit f2233fbf40f3f69309ce5cc714e99fcbdcd33ec3
5858
+Subproject commit a88a777df3909a61be97f1a7b1194dad6de25702-dirty
59-
diff --git a/git/test/fixtures/diff_patch_binary b/git/test/fixtures/diff_patch_binary
59+
diff --git a/test/fixtures/diff_patch_binary b/test/fixtures/diff_patch_binary
6060
new file mode 100644
6161
index 0000000000000000000000000000000000000000..c92ccd6ebc92a871d38ad7cb8a48bcdb1a5dbc33
6262
--- /dev/null
63-
+++ b/git/test/fixtures/diff_patch_binary
63+
+++ b/test/fixtures/diff_patch_binary
6464
@@ -0,0 +1,3 @@
6565
+diff --git a/rps b/rps
6666
+index f4567df37451b230b1381b1bc9c2bcad76e08a3c..736bd596a36924d30b480942e9475ce0d734fa0d 100755
6767
+Binary files a/rps and b/rps differ
68-
diff --git a/git/test/fixtures/diff_raw_binary b/git/test/fixtures/diff_raw_binary
68+
diff --git a/test/fixtures/diff_raw_binary b/test/fixtures/diff_raw_binary
6969
new file mode 100644
7070
index 0000000000000000000000000000000000000000..d4673fa41ee8413384167fc7b9f25e4daf18a53a
7171
--- /dev/null
72-
+++ b/git/test/fixtures/diff_raw_binary
72+
+++ b/test/fixtures/diff_raw_binary
7373
@@ -0,0 +1 @@
7474
+:100755 100755 f4567df37451b230b1381b1bc9c2bcad76e08a3c 736bd596a36924d30b480942e9475ce0d734fa0d Mrps
75-
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
75+
diff --git a/test/test_diff.py b/test/test_diff.py
7676
index ce0f64f2261bd8de063233108caac1f26742c1fd..4de26f8884fd048ac7f10007f2bf7c7fa3fa60f4 100644
77-
--- a/git/test/test_diff.py
78-
+++ b/git/test/test_diff.py
77+
--- a/test/test_diff.py
78+
+++ b/test/test_diff.py
7979
@@ -65,6 +65,21 @@ class TestDiff(TestBase):
8080
assert diff.rename_to == 'that'
8181
assert len(list(diffs.iter_change_type('R'))) == 1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎git/test/lib/helper.pyrenamed to‎test/lib/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
ospd=osp.dirname
3131

32-
GIT_REPO=os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE",ospd(ospd(ospd(ospd(__file__)))))
32+
GIT_REPO=os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE",ospd(ospd(ospd(__file__))))
3333
GIT_DAEMON_PORT=os.environ.get("GIT_PYTHON_TEST_GIT_DAEMON_PORT","19418")
3434

3535
__all__= (
File renamed without changes.

‎git/test/performance/lib.pyrenamed to‎test/performance/lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
GitCmdObjectDB,
1111
GitDB
1212
)
13-
fromgit.test.libimport (
13+
fromtest.libimport (
1414
TestBase
1515
)
1616
fromgit.utilimportrmtree

‎git/test/performance/test_commit.pyrenamed to‎test/performance/test_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .libimportTestBigRepoRW
1212
fromgitimportCommit
1313
fromgitdbimportIStream
14-
fromgit.test.test_commitimportTestCommitSerialization
14+
fromtest.test_commitimportTestCommitSerialization
1515

1616

1717
classTestPerformance(TestBigRepoRW,TestCommitSerialization):
File renamed without changes.

‎git/test/performance/test_streams.pyrenamed to‎test/performance/test_streams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
importsys
77
fromtimeimporttime
88

9-
fromgit.test.libimport (
9+
fromtest.libimport (
1010
with_rw_repo
1111
)
1212
fromgit.utilimportbin_to_hex

‎git/test/test_actor.pyrenamed to‎test/test_actor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
fromgit.test.libimportTestBase
7+
fromtest.libimportTestBase
88
fromgitimportActor
99

1010

‎git/test/test_base.pyrenamed to‎test/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818
fromgit.compatimportis_win
1919
fromgit.objects.utilimportget_object_type_by_name
20-
fromgit.test.libimport (
20+
fromtest.libimport (
2121
TestBase,
2222
with_rw_repo,
2323
with_rw_and_rw_remote_repo

‎git/test/test_blob.pyrenamed to‎test/test_blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
fromgit.test.libimportTestBase
7+
fromtest.libimportTestBase
88
fromgitimportBlob
99

1010

‎git/test/test_commit.pyrenamed to‎test/test_commit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
fromgitimportRepo
2121
fromgit.objects.utilimporttzoffset,utc
2222
fromgit.repo.funimporttouch
23-
fromgit.test.libimport (
23+
fromtest.libimport (
2424
TestBase,
2525
with_rw_repo,
2626
fixture_path,
2727
StringProcessAdapter
2828
)
29-
fromgit.test.libimportwith_rw_directory
29+
fromtest.libimportwith_rw_directory
3030
fromgitdbimportIStream
3131

3232
importos.pathasosp

‎git/test/test_config.pyrenamed to‎test/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
GitConfigParser
1212
)
1313
fromgit.configimport_OMD,cp
14-
fromgit.test.libimport (
14+
fromtest.libimport (
1515
TestCase,
1616
fixture_path,
1717
SkipTest,
1818
)
19-
fromgit.test.libimportwith_rw_directory
19+
fromtest.libimportwith_rw_directory
2020

2121
importos.pathasosp
2222
fromgit.utilimportrmfile

‎git/test/test_db.pyrenamed to‎test/test_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
fromgit.dbimportGitCmdObjectDB
77
fromgit.excimportBadObject
8-
fromgit.test.libimportTestBase
8+
fromtest.libimportTestBase
99
fromgit.utilimportbin_to_hex
1010

1111
importos.pathasosp

‎git/test/test_diff.pyrenamed to‎test/test_diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
Submodule,
1717
)
1818
fromgit.cmdimportGit
19-
fromgit.test.libimport (
19+
fromtest.libimport (
2020
TestBase,
2121
StringProcessAdapter,
2222
fixture,
2323
)
24-
fromgit.test.libimportwith_rw_directory
24+
fromtest.libimportwith_rw_directory
2525

2626
importos.pathasosp
2727

‎git/test/test_docs.pyrenamed to‎test/test_docs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
77
importos
88

9-
fromgit.test.libimportTestBase
10-
fromgit.test.lib.helperimportwith_rw_directory
9+
fromtest.libimportTestBase
10+
fromtest.lib.helperimportwith_rw_directory
1111

1212
importos.path
1313

‎git/test/test_exc.pyrenamed to‎test/test_exc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
HookExecutionError,
2323
RepositoryDirtyError,
2424
)
25-
fromgit.test.libimportTestBase
25+
fromtest.libimportTestBase
2626

2727
importitertoolsasitt
2828

‎git/test/test_fun.pyrenamed to‎test/test_fun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
fromgit.repo.funimport (
1919
find_worktree_git_dir
2020
)
21-
fromgit.test.libimport (
21+
fromtest.libimport (
2222
TestBase,
2323
with_rw_repo,
2424
with_rw_directory

‎git/test/test_git.pyrenamed to‎test/test_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
cmd
2020
)
2121
fromgit.compatimportis_darwin
22-
fromgit.test.libimport (
22+
fromtest.libimport (
2323
TestBase,
2424
fixture_path
2525
)
26-
fromgit.test.libimportwith_rw_directory
26+
fromtest.libimportwith_rw_directory
2727
fromgit.utilimportfinalize_process
2828

2929
importos.pathasosp

‎git/test/test_index.pyrenamed to‎test/test_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
IndexEntry
3737
)
3838
fromgit.objectsimportBlob
39-
fromgit.test.libimport (
39+
fromtest.libimport (
4040
TestBase,
4141
fixture_path,
4242
fixture,
4343
with_rw_repo
4444
)
45-
fromgit.test.libimportwith_rw_directory
45+
fromtest.libimportwith_rw_directory
4646
fromgit.utilimportActor,rmtree
4747
fromgit.utilimportHIDE_WINDOWS_KNOWN_ERRORS,hex_to_bin
4848
fromgitdb.baseimportIStream

‎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")

‎git/test/test_reflog.pyrenamed to‎test/test_reflog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
RefLogEntry,
77
RefLog
88
)
9-
fromgit.test.libimport (
9+
fromtest.libimport (
1010
TestBase,
1111
fixture_path
1212
)

‎git/test/test_refs.pyrenamed to‎test/test_refs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
RefLog
1818
)
1919
fromgit.objects.tagimportTagObject
20-
fromgit.test.libimport (
20+
fromtest.libimport (
2121
TestBase,
2222
with_rw_repo
2323
)

‎git/test/test_remote.pyrenamed to‎test/test_remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
GitCommandError
2323
)
2424
fromgit.cmdimportGit
25-
fromgit.test.libimport (
25+
fromtest.libimport (
2626
TestBase,
2727
with_rw_repo,
2828
with_rw_and_rw_remote_repo,

‎git/test/test_repo.pyrenamed to‎test/test_repo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
BadObject,
3737
)
3838
fromgit.repo.funimporttouch
39-
fromgit.test.libimport (
39+
fromtest.libimport (
4040
TestBase,
4141
with_rw_repo,
4242
fixture
4343
)
4444
fromgit.utilimportHIDE_WINDOWS_KNOWN_ERRORS,cygpath
45-
fromgit.test.libimportwith_rw_directory
45+
fromtest.libimportwith_rw_directory
4646
fromgit.utilimportjoin_path_native,rmtree,rmfile,bin_to_hex
4747

4848
importos.pathasosp
@@ -865,7 +865,7 @@ def last_commit(repo, rev, path):
865865
for_inrange(64):
866866
forrepo_typein (GitCmdObjectDB,GitDB):
867867
repo=Repo(self.rorepo.working_tree_dir,odbt=repo_type)
868-
last_commit(repo,'master','git/test/test_base.py')
868+
last_commit(repo,'master','test/test_base.py')
869869
# end for each repository type
870870
# end for each iteration
871871

‎git/test/test_stats.pyrenamed to‎test/test_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
fromgit.test.libimport (
7+
fromtest.libimport (
88
TestBase,
99
fixture
1010
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp