From a1b76342be030cfff6f5e2c770e8ee831c63ec3c Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 16:49:49 +0100 Subject: [PATCH 01/17] Add files via upload --- dev-requirements.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 dev-requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 000000000..abb677d00 --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,10 @@ +ddt>=1.1.1 +coverage +flake8 +flake8-type-checking;python_version>="3.8" +tox +mypy +pytest +pytest-cov +gitdb>=4.0.1,<5 +typing-extensions>=3.7.4.3;python_version<"3.10" From fefda8c962e394bcc922056ce74ee33ae760a69a Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 16:50:29 +0100 Subject: [PATCH 02/17] Add files via upload --- .github/workflows/test_pytest.yml | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/test_pytest.yml diff --git a/.github/workflows/test_pytest.yml b/.github/workflows/test_pytest.yml new file mode 100644 index 000000000..55c8e9844 --- /dev/null +++ b/.github/workflows/test_pytest.yml @@ -0,0 +1,55 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + 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@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies and prepare tests + run: | + set -x + python -m pip install --upgrade pip + python --version; git --version + git submodule update --init --recursive + git fetch --tags + + pip install -r dev-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: Test with pytest + run: | + set -x + pip install -r dev-requirements.txt + pytest --cov --cov-report=term-missing:skip-covered + # --cov-report=html:test/coverage + continue-on-error: true + + + + + From ec365801aecec611ea8984b4e9575d7dcab6ed04 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 16:51:26 +0100 Subject: [PATCH 03/17] Update test-requirements.txt --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index ab3f86109..a8a3a1527 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,6 +3,6 @@ coverage flake8 tox virtualenv -nose +nose;python_version<"3.10" gitdb>=4.0.1,<5 typing-extensions>=3.7.4.3;python_version<"3.10" From d77b3c0794e1b8e24b7917d7d480305b8063e36d Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 16:52:50 +0100 Subject: [PATCH 04/17] Update test_pytest.yml --- .github/workflows/test_pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_pytest.yml b/.github/workflows/test_pytest.yml index 55c8e9844..627e720f1 100644 --- a/.github/workflows/test_pytest.yml +++ b/.github/workflows/test_pytest.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python package +name: Future on: push: From 185d847ec7647fd2642a82d9205fb3d07ea71715 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 17:02:21 +0100 Subject: [PATCH 05/17] Update and rename test_pytest.yml to Future.yml --- .github/workflows/{test_pytest.yml => Future.yml} | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename .github/workflows/{test_pytest.yml => Future.yml} (92%) diff --git a/.github/workflows/test_pytest.yml b/.github/workflows/Future.yml similarity index 92% rename from .github/workflows/test_pytest.yml rename to .github/workflows/Future.yml index 627e720f1..39146533b 100644 --- a/.github/workflows/test_pytest.yml +++ b/.github/workflows/Future.yml @@ -5,7 +5,9 @@ name: Future on: push: - branches: [main] + branches: [ main ] + pull_request: + branches: [ main ] jobs: build: From 882f2a5e93c60e1aad0ab04a6e3eeb09170dee00 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:08:40 +0100 Subject: [PATCH 06/17] Delete Future.yml Combined pytest into usual workflow --- .github/workflows/Future.yml | 57 ------------------------------------ 1 file changed, 57 deletions(-) delete mode 100644 .github/workflows/Future.yml diff --git a/.github/workflows/Future.yml b/.github/workflows/Future.yml deleted file mode 100644 index 39146533b..000000000 --- a/.github/workflows/Future.yml +++ /dev/null @@ -1,57 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Future - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - 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@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies and prepare tests - run: | - set -x - python -m pip install --upgrade pip - python --version; git --version - git submodule update --init --recursive - git fetch --tags - - pip install -r dev-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: Test with pytest - run: | - set -x - pip install -r dev-requirements.txt - pytest --cov --cov-report=term-missing:skip-covered - # --cov-report=html:test/coverage - continue-on-error: true - - - - - From bc48d753c29f776554e1d7ef57f5727fe885d34e Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:10:29 +0100 Subject: [PATCH 07/17] Update pythonpackage.yml Add pytest step to workflow Add pip install setuptools and wheel Invoke mypy directly, no need for tox --- .github/workflows/pythonpackage.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 53da76149..1560c011c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -28,37 +28,50 @@ jobs: - 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 nose run: | set -x pip install nose nosetests -v --with-coverage + - name: Documentation run: | set -x pip install -r doc/requirements.txt make -C doc html + + - name: Test with pytest + run: | + set -x + pip install -r requirements-dev.txt + pytest + # pytest settings in tox.ini[pytest] + continue-on-error: true From 4f9ef1f80c20dc913f707e079847c787a30b7313 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:12:03 +0100 Subject: [PATCH 08/17] Update dev-requirements.txt Add pytest plugins --- dev-requirements.txt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index abb677d00..6644bacde 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,10 +1,7 @@ -ddt>=1.1.1 -coverage -flake8 -flake8-type-checking;python_version>="3.8" -tox -mypy +-r requirements.txt +-r test-requirements.txt + pytest pytest-cov -gitdb>=4.0.1,<5 -typing-extensions>=3.7.4.3;python_version<"3.10" +pytest-sugar +pytest-icdiff From 89d7611d39991d96a8c44121a3ea82d10b611446 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:16:14 +0100 Subject: [PATCH 09/17] Update tox.ini Ignore flake8 E704 (Multiple statements on one line) too make overloads smaller Add [pytest] config section --- tox.ini | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) 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 From 6460db1d62ac2d7b7b336b4c3d2b11735aded803 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:19:19 +0100 Subject: [PATCH 10/17] Update setup.py Change distutils.build_py to its setuptools wrapper. Distutils one deprecated since py3.8, but setuptools one working py3.6-3.10 --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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'}, From 07f5680fbf8e108af2a98de5c2fbc9e22a59f310 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:54:01 +0100 Subject: [PATCH 11/17] Rename dev-requirements.txt to requirements-dev.txt --- dev-requirements.txt => requirements-dev.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dev-requirements.txt => requirements-dev.txt (100%) diff --git a/dev-requirements.txt b/requirements-dev.txt similarity index 100% rename from dev-requirements.txt rename to requirements-dev.txt From 37c7121898b8f8b611a78308b3f0660de031021a Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:58:50 +0100 Subject: [PATCH 12/17] Update pythonpackage.yml Remove nose --- .github/workflows/pythonpackage.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 1560c011c..c350f78a4 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -56,12 +56,6 @@ jobs: pip install mypy mypy -p git - - name: Test with nose - run: | - set -x - pip install nose - nosetests -v --with-coverage - - name: Documentation run: | set -x From 3b9b1538cb4eb58a35eaa1db60b9ac2900682b37 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 22:59:51 +0100 Subject: [PATCH 13/17] Update test-requirements.txt Replace nose with pytest --- test-requirements.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index a8a3a1527..7359ed008 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,6 +3,8 @@ coverage flake8 tox virtualenv -nose;python_version<"3.10" +pytest +pytest-cov +pytest-sugar gitdb>=4.0.1,<5 typing-extensions>=3.7.4.3;python_version<"3.10" From dfce27f1e8592162f5c6ce0cecb287c7eac64c6e Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 23:04:29 +0100 Subject: [PATCH 14/17] Update pythonpackage.yml Move pytest before Documentation in workflow --- .github/workflows/pythonpackage.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 67832dc3c..4d3652a30 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -62,12 +62,6 @@ pythonpackage.yml pip install mypy mypy -p git - - name: Documentation - run: | - set -x - pip install -r doc/requirements.txt - make -C doc html - - name: Test with pytest run: | set -x @@ -75,3 +69,11 @@ pythonpackage.yml pytest # pytest settings in tox.ini[pytest] continue-on-error: true + + - name: Documentation + run: | + set -x + pip install -r doc/requirements.txt + make -C doc html + + From a8e01c10166815d5ddd8d6ad2cfe3425b509f739 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 23:11:21 +0100 Subject: [PATCH 15/17] Add pytests args Not sure it is picking up the tox.ini --- .github/workflows/pythonpackage.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4d3652a30..9202a49f7 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -29,12 +29,6 @@ jobs: run: | set -x python -m pip install --upgrade pip setuptools wheel -1 conflicting file -pythonpackage.yml -.github/workflows/pythonpackage.yml -.github/workflows/pythonpackage.yml -1 conflict - python --version; git --version git submodule update --init --recursive git fetch --tags @@ -61,19 +55,25 @@ pythonpackage.yml set -x pip install mypy mypy -p git - + - name: Test with pytest run: | set -x pip install -r requirements-dev.txt - pytest + pytest --cov --cov-report=term # pytest settings in tox.ini[pytest] continue-on-error: true - + - 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 + From 907aae8eb0cd2bf32bf3b55b394b6c7fe1dda658 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 23:18:43 +0100 Subject: [PATCH 16/17] Update pythonpackage.yml Add 3.10.0-beta.3 to test matrix. (beta 4 out, but wouldn't install. Need to force cache emptying?) --- .github/workflows/pythonpackage.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9202a49f7..b9811654c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ 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 @@ -62,7 +62,7 @@ jobs: pip install -r requirements-dev.txt pytest --cov --cov-report=term # pytest settings in tox.ini[pytest] - continue-on-error: true + continue-on-error: false - name: Documentation run: | @@ -75,5 +75,6 @@ jobs: # set -x # pip install nose # nosetests -v --with-coverage + # continue-on-error: false From 3ef208cb9119bd7f8345f55b991ad196bcdffeb4 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 12 Jul 2021 23:23:27 +0100 Subject: [PATCH 17/17] Update pythonpackage.yml update to actions/setup-python@v1 --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index b9811654c..e575a0161 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -22,7 +22,7 @@ jobs: 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