Skip to content

Commit 3edd16c

Browse files
authored
Merge pull request gitpython-developers#1031 from priv-kweihmann/move-test-2nd
[RFC/WIP] move tests and avoid packaging them
2 parents 9cb7ae8 + e0b10d9 commit 3edd16c

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-
cat git/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
from distutils.command.build_py import build_py as _build_py
1111
from setuptools.command.sdist import sdist as _sdist
12+
import fnmatch
1213
import os
1314
import sys
1415
from os import path
@@ -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+
def build_py_modules(basedir, excludes=[]):
71+
# create list of py_modules from tree
72+
res = set()
73+
_prefix = os.path.basename(basedir)
74+
for root, _, files in os.walk(basedir):
75+
for f in files:
76+
_f, _ext = os.path.splitext(f)
77+
if _ext not in [".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+
if any(fnmatch.fnmatch(_f, x) for x in excludes):
83+
continue
84+
res.add(_f)
85+
return list(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
7695
url="https://github.com/gitpython-developers/GitPython",
77-
packages=find_packages('.'),
78-
py_modules=['git.' + f[:-3] for f in os.listdir('./git') if f.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.

0 commit comments

Comments
 (0)