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

Commit 63f5541

Browse files
authored
Merge pull request #1289 from gitpython-developers/pytest
Tidying up, and replace nose with pytest. No code changes, and i've been working on my branch with pytest with no problems, so i'm merging now
2 parents b66bfbd + 3ef208c commit 63f5541

File tree

5 files changed

+66
-17
lines changed

5 files changed

+66
-17
lines changed

‎.github/workflows/pythonpackage.yml‎

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,66 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.6, 3.7, 3.8, 3.9]
18+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10.0-beta.3"]
1919

2020
steps:
2121
- uses: actions/checkout@v2
2222
with:
2323
fetch-depth: 9999
2424
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v1
25+
uses: actions/setup-python@v2
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install dependencies and prepare tests
2929
run: |
3030
set -x
31-
python -m pip install --upgrade pip
31+
python -m pip install --upgrade pip setuptools wheel
3232
python --version; git --version
3333
git submodule update --init --recursive
3434
git fetch --tags
35-
35+
36+
pip install -r requirements.txt
3637
pip install -r test-requirements.txt
3738
TRAVIS=yes ./init-tests-after-clone.sh
38-
39+
3940
git config --global user.email "travis@ci.com"
4041
git config --global user.name "Travis Runner"
4142
# If we rewrite the user's config by accident, we will mess it up
4243
# and cause subsequent tests to fail
4344
cat test/fixtures/.gitconfig >> ~/.gitconfig
45+
4446
- name: Lint with flake8
45-
4647
run: |
4748
set -x
4849
pip install flake8
4950
# stop the build if there are Python syntax errors or undefined names
50-
flake8 --ignore=W293,E265,E266,W503,W504,E731 --count --show-source --statistics
51-
51+
flake8 --ignore=W293,E265,E266,W503,W504,E704,E731 --count --show-source --statistics
52+
5253
- name: Check types with mypy
5354
run: |
5455
set -x
55-
pip install tox
56-
tox -e type
56+
pip install mypy
57+
mypy -p git
58+
59+
- name: Test with pytest
60+
run: |
61+
set -x
62+
pip install -r requirements-dev.txt
63+
pytest --cov --cov-report=term
64+
# pytest settings in tox.ini[pytest]
65+
continue-on-error: false
5766

5867
- name: Documentation
5968
run: |
6069
set -x
6170
pip install -r doc/requirements.txt
6271
make -C doc html
72+
73+
# - name: Test with nose
74+
# run: |
75+
# set -x
76+
# pip install nose
77+
# nosetests -v --with-coverage
78+
# continue-on-error: false
79+
80+

‎requirements-dev.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-r requirements.txt
2+
-r test-requirements.txt
3+
4+
pytest
5+
pytest-cov
6+
pytest-sugar
7+
pytest-icdiff

‎setup.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env python
2-
from __future__ import print_function
32
try:
43
from setuptools import setup, find_packages
54
except ImportError:
6-
from ez_setup import use_setuptools
5+
from ez_setup import use_setuptools# type: ignore[Pylance]
76
use_setuptools()
87
from setuptools import setup, find_packages
98

10-
from distutils.command.build_py import build_py as _build_py
9+
from setuptools.command.build_py import build_py as _build_py
1110
from setuptools.command.sdist import sdist as _sdist
1211
import fnmatch
1312
import os
@@ -95,7 +94,6 @@ def build_py_modules(basedir, excludes=[]):
9594
license="BSD",
9695
url="https://github.com/gitpython-developers/GitPython",
9796
packages=find_packages(exclude=("test.*")),
98-
# package_data={'git': ['**/*.pyi', 'py.typed']},
9997
include_package_data=True,
10098
py_modules=build_py_modules("./git", excludes=["git.ext.*"]),
10199
package_dir={'git': 'git'},

‎test-requirements.txt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ coverage
33
flake8
44
tox
55
virtualenv
6-
nose
6+
pytest
7+
pytest-cov
8+
pytest-sugar
79
gitdb>=4.0.1,<5
810
typing-extensions>=3.7.4.3;python_version<"3.10"

‎tox.ini‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ commands = coverage run --omit="git/test/*" -m unittest --buffer {posargs}
1212
coverage report
1313

1414
[testenv:flake8]
15-
commands = flake8 --ignore=W293,E265,E266,W503,W504,E731 {posargs}
15+
commands = flake8 --ignore=W293,E265,E266,W503,W504,E704,E731 {posargs}
1616

1717
[testenv:type]
1818
description = type check ourselves
@@ -32,6 +32,30 @@ commands = {posargs}
3232
# E731 = do not assign a lambda expression, use a def
3333
# W293 = Blank line contains whitespace
3434
# W504 = Line break after operator
35-
ignore = E265,W293,E266,E731, W504
35+
# E707 = multiple statements in one line - used for @overloads
36+
ignore = E265,W293,E266,E731,E704, W504
3637
max-line-length = 120
3738
exclude = .tox,.venv,build,dist,doc,git/ext/
39+
40+
[pytest]
41+
python_files =
42+
test_*.py
43+
44+
# space seperated list of paths from root e.g test tests doc/testing
45+
testpaths = test
46+
47+
# --cov coverage
48+
# --cov-report term # send report to terminal term-missing -> terminal with line numbers html xml
49+
# --cov-report term-missing # to terminal with line numbers
50+
# --cov-report html:path # html file at path
51+
# --maxfail # number of errors before giving up
52+
# -disable-warnings # Disable pytest warnings (not codebase warnings)
53+
#-rf # increased reporting of failures
54+
# -rE # increased reporting of errors
55+
# --ignore-glob=**/gitdb/* # ignore glob paths
56+
addopts = --cov=git --cov-report=term --maxfail=50 -rf --verbosity=0 --disable-warnings
57+
58+
# ignore::WarningType # ignores those warnings
59+
# error # turn any unignored warning into errors
60+
filterwarnings =
61+
ignore::DeprecationWarning

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /