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

[RFC/WIP] move tests and avoid packaging them#1031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 5 commits intogitpython-developers:masterfrompriv-kweihmann:move-test-2nd
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion.deepsource.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
version = 1

test_patterns = [
'git/test/**/test_*.py'
'test/**/test_*.py'
]

exclude_patterns = [
Expand Down
2 changes: 1 addition & 1 deletion.gitattributes
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
git/test/fixtures/* eol=lf
test/fixtures/* eol=lf
init-tests-after-clone.sh
2 changes: 1 addition & 1 deletion.github/workflows/pythonpackage.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,7 @@ jobs:
git config --global user.name "Travis Runner"
# If we rewrite the user's config by accident, we will mess it up
# and cause subsequent tests to fail
catgit/test/fixtures/.gitconfig >> ~/.gitconfig
cat test/fixtures/.gitconfig >> ~/.gitconfig
- name: Lint with flake8
run: |
set -x
Expand Down
2 changes: 1 addition & 1 deletion.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ script:
# Make sure we limit open handles to see if we are leaking them
- ulimit -n 128
- ulimit -n
- coverage run --omit="git/test/*" -m unittest --buffer
- coverage run --omit="test/*" -m unittest --buffer
- coverage report
- if [ "$TRAVIS_PYTHON_VERSION" == '3.5' ]; then cd doc && make html; fi
- if [ "$TRAVIS_PYTHON_VERSION" == '3.6' ]; then flake8 --ignore=W293,E265,E266,W503,W504,E731; fi
Expand Down
5 changes: 1 addition & 4 deletionsMANIFEST.in
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,11 +5,8 @@ include AUTHORS
include CONTRIBUTING.md
include README.md
include requirements.txt
include test-requirements.txt

recursive-include doc *

graft git/test/fixtures
graft git/test/performance
recursive-exclude test *

global-exclude __pycache__ *.pyc
25 changes: 22 additions & 3 deletionssetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@

from distutils.command.build_py import build_py as _build_py
from setuptools.command.sdist import sdist as _sdist
import fnmatch
import os
import sys
from os import path
Expand DownExpand Up@@ -66,6 +67,24 @@ def _stamp_version(filename):
print("WARNING: Couldn't find version line in file %s" % filename, file=sys.stderr)


def build_py_modules(basedir, excludes=[]):
# create list of py_modules from tree
res = set()
_prefix = os.path.basename(basedir)
for root, _, files in os.walk(basedir):
for f in files:
_f, _ext = os.path.splitext(f)
if _ext not in [".py"]:
continue
_f = os.path.join(root, _f)
_f = os.path.relpath(_f, basedir)
_f = "{}.{}".format(_prefix, _f.replace(os.sep, "."))
if any(fnmatch.fnmatch(_f, x) for x in excludes):
continue
res.add(_f)
return list(res)


setup(
name="GitPython",
cmdclass={'build_py': build_py, 'sdist': sdist},
Expand All@@ -74,9 +93,9 @@ def _stamp_version(filename):
author="Sebastian Thiel, Michael Trier",
author_email="byronimo@gmail.com, mtrier@gmail.com",
url="https://github.com/gitpython-developers/GitPython",
packages=find_packages('.'),
py_modules=['git.' + f[:-3] for f in os.listdir('./git') if f.endswith('.py')],
package_data={'git.test': ['fixtures/*']},
packages=find_packages(exclude=("test.*")),
include_package_data=True,
py_modules=build_py_modules("./git", excludes=["git.ext.*"]),
package_dir={'git': 'git'},
python_requires='>=3.4',
install_requires=requirements,
Expand Down
1 change: 1 addition & 0 deletionstest-requirements.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,3 +2,4 @@ ddt>=1.1.1
coverage
flake8
tox
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.
File renamed without changes.
File renamed without changes.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,26 +56,26 @@ index f2233fbf40f3f69309ce5cc714e99fcbdcd33ec3..a88a777df3909a61be97f1a7b1194dad
@@ -1 +1 @@
-Subproject commit f2233fbf40f3f69309ce5cc714e99fcbdcd33ec3
+Subproject commit a88a777df3909a61be97f1a7b1194dad6de25702-dirty
diff --git a/git/test/fixtures/diff_patch_binary b/git/test/fixtures/diff_patch_binary
diff --git a/test/fixtures/diff_patch_binary b/test/fixtures/diff_patch_binary
new file mode 100644
index 0000000000000000000000000000000000000000..c92ccd6ebc92a871d38ad7cb8a48bcdb1a5dbc33
--- /dev/null
+++ b/git/test/fixtures/diff_patch_binary
+++ b/test/fixtures/diff_patch_binary
@@ -0,0 +1,3 @@
+diff --git a/rps b/rps
+index f4567df37451b230b1381b1bc9c2bcad76e08a3c..736bd596a36924d30b480942e9475ce0d734fa0d 100755
+Binary files a/rps and b/rps differ
diff --git a/git/test/fixtures/diff_raw_binary b/git/test/fixtures/diff_raw_binary
diff --git a/test/fixtures/diff_raw_binary b/test/fixtures/diff_raw_binary
new file mode 100644
index 0000000000000000000000000000000000000000..d4673fa41ee8413384167fc7b9f25e4daf18a53a
--- /dev/null
+++ b/git/test/fixtures/diff_raw_binary
+++ b/test/fixtures/diff_raw_binary
@@ -0,0 +1 @@
+:100755 100755 f4567df37451b230b1381b1bc9c2bcad76e08a3c 736bd596a36924d30b480942e9475ce0d734fa0d Mrps
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
diff --git a/test/test_diff.py b/test/test_diff.py
index ce0f64f2261bd8de063233108caac1f26742c1fd..4de26f8884fd048ac7f10007f2bf7c7fa3fa60f4 100644
--- a/git/test/test_diff.py
+++ b/git/test/test_diff.py
--- a/test/test_diff.py
+++ b/test/test_diff.py
@@ -65,6 +65,21 @@ class TestDiff(TestBase):
assert diff.rename_to == 'that'
assert len(list(diffs.iter_change_type('R'))) == 1
Expand Down
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletiongit/test/lib/helper.py → test/lib/helper.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@

ospd = osp.dirname

GIT_REPO = os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE", ospd(ospd(ospd(ospd(__file__)))))
GIT_REPO = os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE", ospd(ospd(ospd(__file__))))
GIT_DAEMON_PORT = os.environ.get("GIT_PYTHON_TEST_GIT_DAEMON_PORT", "19418")

__all__ = (
Expand Down
File renamed without changes.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@
GitCmdObjectDB,
GitDB
)
fromgit.test.lib import (
from test.lib import (
TestBase
)
from git.util import rmtree
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@
from .lib import TestBigRepoRW
from git import Commit
from gitdb import IStream
fromgit.test.test_commit import TestCommitSerialization
from test.test_commit import TestCommitSerialization


class TestPerformance(TestBigRepoRW, TestCommitSerialization):
Expand Down
File renamed without changes.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@
import sys
from time import time

fromgit.test.lib import (
from test.lib import (
with_rw_repo
)
from git.util import bin_to_hex
Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_actor.py → test/test_actor.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php

fromgit.test.lib import TestBase
from test.lib import TestBase
from git import Actor


Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_base.py → test/test_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@
)
from git.compat import is_win
from git.objects.util import get_object_type_by_name
fromgit.test.lib import (
from test.lib import (
TestBase,
with_rw_repo,
with_rw_and_rw_remote_repo
Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_blob.py → test/test_blob.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php

fromgit.test.lib import TestBase
from test.lib import TestBase
from git import Blob


Expand Down
4 changes: 2 additions & 2 deletionsgit/test/test_commit.py → test/test_commit.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,13 +20,13 @@
from git import Repo
from git.objects.util import tzoffset, utc
from git.repo.fun import touch
fromgit.test.lib import (
from test.lib import (
TestBase,
with_rw_repo,
fixture_path,
StringProcessAdapter
)
fromgit.test.lib import with_rw_directory
from test.lib import with_rw_directory
from gitdb import IStream

import os.path as osp
Expand Down
4 changes: 2 additions & 2 deletionsgit/test/test_config.py → test/test_config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,12 +11,12 @@
GitConfigParser
)
from git.config import _OMD, cp
fromgit.test.lib import (
from test.lib import (
TestCase,
fixture_path,
SkipTest,
)
fromgit.test.lib import with_rw_directory
from test.lib import with_rw_directory

import os.path as osp
from git.util import rmfile
Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_db.py → test/test_db.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.db import GitCmdObjectDB
from git.exc import BadObject
fromgit.test.lib import TestBase
from test.lib import TestBase
from git.util import bin_to_hex

import os.path as osp
Expand Down
4 changes: 2 additions & 2 deletionsgit/test/test_diff.py → test/test_diff.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,12 @@
Submodule,
)
from git.cmd import Git
fromgit.test.lib import (
from test.lib import (
TestBase,
StringProcessAdapter,
fixture,
)
fromgit.test.lib import with_rw_directory
from test.lib import with_rw_directory

import os.path as osp

Expand Down
4 changes: 2 additions & 2 deletionsgit/test/test_docs.py → test/test_docs.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,8 +6,8 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os

fromgit.test.lib import TestBase
fromgit.test.lib.helper import with_rw_directory
from test.lib import TestBase
from test.lib.helper import with_rw_directory

import os.path

Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_exc.py → test/test_exc.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@
HookExecutionError,
RepositoryDirtyError,
)
fromgit.test.lib import TestBase
from test.lib import TestBase

import itertools as itt

Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_fun.py → test/test_fun.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
from git.repo.fun import (
find_worktree_git_dir
)
fromgit.test.lib import (
from test.lib import (
TestBase,
with_rw_repo,
with_rw_directory
Expand Down
4 changes: 2 additions & 2 deletionsgit/test/test_git.py → test/test_git.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,11 +19,11 @@
cmd
)
from git.compat import is_darwin
fromgit.test.lib import (
from test.lib import (
TestBase,
fixture_path
)
fromgit.test.lib import with_rw_directory
from test.lib import with_rw_directory
from git.util import finalize_process

import os.path as osp
Expand Down
4 changes: 2 additions & 2 deletionsgit/test/test_index.py → test/test_index.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,13 +36,13 @@
IndexEntry
)
from git.objects import Blob
fromgit.test.lib import (
from test.lib import (
TestBase,
fixture_path,
fixture,
with_rw_repo
)
fromgit.test.lib import with_rw_directory
from test.lib import with_rw_directory
from git.util import Actor, rmtree
from git.util import HIDE_WINDOWS_KNOWN_ERRORS, hex_to_bin
from gitdb.base import IStream
Expand Down
29 changes: 29 additions & 0 deletionstest/test_installation.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php

import os
import subprocess
from test.lib import TestBase
from test.lib.helper import with_rw_directory


class TestInstallation(TestBase):
def setUp_venv(self, rw_dir):
self.venv = rw_dir
subprocess.run(['virtualenv', self.venv], stdout=subprocess.PIPE)
self.python = os.path.join(self.venv, 'bin/python3')
self.pip = os.path.join(self.venv, 'bin/pip3')
self.sources = os.path.join(self.venv, "src")
self.cwd = os.path.dirname(os.path.dirname(__file__))
os.symlink(self.cwd, self.sources, target_is_directory=True)

@with_rw_directory
def test_installation(self, rw_dir):
self.setUp_venv(rw_dir)
result = subprocess.run([self.pip, 'install', '-r', 'requirements.txt'],
stdout=subprocess.PIPE, cwd=self.sources)
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Can't install requirements")
result = subprocess.run([self.python, 'setup.py', 'install'], stdout=subprocess.PIPE, cwd=self.sources)
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Can't build - setup.py failed")
result = subprocess.run([self.python, '-c', 'import git'], stdout=subprocess.PIPE, cwd=self.sources)
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Selftest failed")
2 changes: 1 addition & 1 deletiongit/test/test_reflog.py → test/test_reflog.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@
RefLogEntry,
RefLog
)
fromgit.test.lib import (
from test.lib import (
TestBase,
fixture_path
)
Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_refs.py → test/test_refs.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@
RefLog
)
from git.objects.tag import TagObject
fromgit.test.lib import (
from test.lib import (
TestBase,
with_rw_repo
)
Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_remote.py → test/test_remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@
GitCommandError
)
from git.cmd import Git
fromgit.test.lib import (
from test.lib import (
TestBase,
with_rw_repo,
with_rw_and_rw_remote_repo,
Expand Down
6 changes: 3 additions & 3 deletionsgit/test/test_repo.py → test/test_repo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,13 +36,13 @@
BadObject,
)
from git.repo.fun import touch
fromgit.test.lib import (
from test.lib import (
TestBase,
with_rw_repo,
fixture
)
from git.util import HIDE_WINDOWS_KNOWN_ERRORS, cygpath
fromgit.test.lib import with_rw_directory
from test.lib import with_rw_directory
from git.util import join_path_native, rmtree, rmfile, bin_to_hex

import os.path as osp
Expand DownExpand Up@@ -865,7 +865,7 @@ def last_commit(repo, rev, path):
for _ in range(64):
for repo_type in (GitCmdObjectDB, GitDB):
repo = Repo(self.rorepo.working_tree_dir, odbt=repo_type)
last_commit(repo, 'master', 'git/test/test_base.py')
last_commit(repo, 'master', 'test/test_base.py')
# end for each repository type
# end for each iteration

Expand Down
2 changes: 1 addition & 1 deletiongit/test/test_stats.py → test/test_stats.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php

fromgit.test.lib import (
from test.lib import (
TestBase,
fixture
)
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp