diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c9faf0f1b..e575a0161 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,48 +15,66 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9, "3.10.0-beta.3"] steps: - uses: actions/checkout@v2 with: fetch-depth: 9999 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies and prepare tests run: | set -x - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools wheel python --version; git --version git submodule update --init --recursive git fetch --tags - + + pip install -r requirements.txt pip install -r test-requirements.txt TRAVIS=yes ./init-tests-after-clone.sh - + git config --global user.email "travis@ci.com" 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 cat test/fixtures/.gitconfig >> ~/.gitconfig + - name: Lint with flake8 - run: | set -x pip install flake8 # stop the build if there are Python syntax errors or undefined names - flake8 --ignore=W293,E265,E266,W503,W504,E731 --count --show-source --statistics - + flake8 --ignore=W293,E265,E266,W503,W504,E704,E731 --count --show-source --statistics + - name: Check types with mypy run: | set -x - pip install tox - tox -e type + pip install mypy + mypy -p git + + - name: Test with pytest + run: | + set -x + pip install -r requirements-dev.txt + pytest --cov --cov-report=term + # pytest settings in tox.ini[pytest] + continue-on-error: false - name: Documentation run: | set -x pip install -r doc/requirements.txt make -C doc html + + # - name: Test with nose + # run: | + # set -x + # pip install nose + # nosetests -v --with-coverage + # continue-on-error: false + + diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 000000000..6644bacde --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,7 @@ +-r requirements.txt +-r test-requirements.txt + +pytest +pytest-cov +pytest-sugar +pytest-icdiff diff --git a/setup.py b/setup.py index 2004be010..e01562e8c 100755 --- a/setup.py +++ b/setup.py @@ -1,13 +1,12 @@ #!/usr/bin/env python -from __future__ import print_function try: from setuptools import setup, find_packages except ImportError: - from ez_setup import use_setuptools + from ez_setup import use_setuptools # type: ignore[Pylance] use_setuptools() from setuptools import setup, find_packages -from distutils.command.build_py import build_py as _build_py +from setuptools.command.build_py import build_py as _build_py from setuptools.command.sdist import sdist as _sdist import fnmatch import os @@ -95,7 +94,6 @@ def build_py_modules(basedir, excludes=[]): license="BSD", url="https://github.com/gitpython-developers/GitPython", packages=find_packages(exclude=("test.*")), - # package_data={'git': ['**/*.pyi', 'py.typed']}, include_package_data=True, py_modules=build_py_modules("./git", excludes=["git.ext.*"]), package_dir={'git': 'git'}, diff --git a/test-requirements.txt b/test-requirements.txt index ab3f86109..7359ed008 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,6 +3,8 @@ coverage flake8 tox virtualenv -nose +pytest +pytest-cov +pytest-sugar gitdb>=4.0.1,<5 typing-extensions>=3.7.4.3;python_version<"3.10" diff --git a/tox.ini b/tox.ini index e3dd84b6b..7231f0459 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,7 @@ commands = coverage run --omit="git/test/*" -m unittest --buffer {posargs} coverage report [testenv:flake8] -commands = flake8 --ignore=W293,E265,E266,W503,W504,E731 {posargs} +commands = flake8 --ignore=W293,E265,E266,W503,W504,E704,E731 {posargs} [testenv:type] description = type check ourselves @@ -32,6 +32,30 @@ commands = {posargs} # E731 = do not assign a lambda expression, use a def # W293 = Blank line contains whitespace # W504 = Line break after operator -ignore = E265,W293,E266,E731, W504 +# E707 = multiple statements in one line - used for @overloads +ignore = E265,W293,E266,E731,E704, W504 max-line-length = 120 exclude = .tox,.venv,build,dist,doc,git/ext/ + +[pytest] +python_files = + test_*.py + +# space seperated list of paths from root e.g test tests doc/testing +testpaths = test + +# --cov coverage +# --cov-report term # send report to terminal term-missing -> terminal with line numbers html xml +# --cov-report term-missing # to terminal with line numbers +# --cov-report html:path # html file at path +# --maxfail # number of errors before giving up +# -disable-warnings # Disable pytest warnings (not codebase warnings) +#-rf # increased reporting of failures +# -rE # increased reporting of errors +# --ignore-glob=**/gitdb/* # ignore glob paths +addopts = --cov=git --cov-report=term --maxfail=50 -rf --verbosity=0 --disable-warnings + +# ignore::WarningType # ignores those warnings +# error # turn any unignored warning into errors +filterwarnings = + ignore::DeprecationWarning