mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
chore: add poetry to handle the tests of the git extras (#1121)
* chore: add poetry to handle the tests of the git extras * chore(ci): upgrade the deps version * chore(CONTRIBUTING): remove the test description
This commit is contained in:
parent
2c2bd07693
commit
28b48c7432
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
|
@ -43,15 +43,15 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.10
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest==7.4.0
|
||||
pip install GitPython==3.1.36
|
||||
pip install GitPython==3.1.40
|
||||
- name: Unit test
|
||||
run: make test
|
||||
|
||||
|
|
|
|||
|
|
@ -14,16 +14,6 @@ Your change must also be compatible with the dependency constraints that we spec
|
|||
|
||||
If you aren't able to test your new command on a platform, make that clear in your PR; someone else may be able to test it on their system.
|
||||
|
||||
## Testing
|
||||
|
||||
We now have a testing suite. Run it with `make test`.
|
||||
|
||||
It uses the following dependencies (same or later versions):
|
||||
|
||||
- `python==3.10`
|
||||
- `pytest==7.4.0`
|
||||
- `GitPython==3.1.36`
|
||||
|
||||
## Adding a New Command
|
||||
|
||||
Let's say you wish to add a new command. Assuming your new command is named `foo`:
|
||||
|
|
|
|||
32
tests/README.md
Normal file
32
tests/README.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Test for git-extras
|
||||
The git-extras has its own testcases now, and the more is on the way! So let's introduce it.
|
||||
|
||||
We choose python to help us to reach to other shore cause **python is life saver**.
|
||||
|
||||
The test part depends on:
|
||||
|
||||
* python >= 3.11
|
||||
* poetry >= 1.7.1
|
||||
* pytest >= 7.4
|
||||
* gitpython >= 3.1.40
|
||||
|
||||
So the versions are higher than above is recommended.
|
||||
|
||||
# How to test
|
||||
1. Install `poetry`
|
||||
2. Install the dependencies via `poetry install --no-root`
|
||||
3. Run `poetry run pytest`
|
||||
|
||||
It is done or go without `poetry`,
|
||||
|
||||
1. Install python >= 3.11
|
||||
2. Install pytest >= 7.4
|
||||
3. Install gitpython >= 3.1.40
|
||||
4. Run `pytest`
|
||||
|
||||
The second way maybe blocked the some missing dependencies at someday, so the first one is recommended.
|
||||
|
||||
# References
|
||||
* [poetry](https://github.com/python-poetry/poetry)
|
||||
* [pytest](https://github.com/pytest-dev/pytest/)
|
||||
* [git python](https://github.com/gitpython-developers/GitPython)
|
||||
116
tests/poetry.lock
generated
Normal file
116
tests/poetry.lock
generated
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
description = "Cross-platform colored terminal text."
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||
files = [
|
||||
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
||||
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitdb"
|
||||
version = "4.0.11"
|
||||
description = "Git Object Database"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "gitdb-4.0.11-py3-none-any.whl", hash = "sha256:81a3407ddd2ee8df444cbacea00e2d038e40150acfa3001696fe0dcf1d3adfa4"},
|
||||
{file = "gitdb-4.0.11.tar.gz", hash = "sha256:bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
smmap = ">=3.0.1,<6"
|
||||
|
||||
[[package]]
|
||||
name = "gitpython"
|
||||
version = "3.1.40"
|
||||
description = "GitPython is a Python library used to interact with Git repositories"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "GitPython-3.1.40-py3-none-any.whl", hash = "sha256:cf14627d5a8049ffbf49915732e5eddbe8134c3bdb9d476e6182b676fc573f8a"},
|
||||
{file = "GitPython-3.1.40.tar.gz", hash = "sha256:22b126e9ffb671fdd0c129796343a02bf67bf2994b35449ffc9321aa755e18a4"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
gitdb = ">=4.0.1,<5"
|
||||
|
||||
[package.extras]
|
||||
test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest", "pytest-cov", "pytest-instafail", "pytest-subtests", "pytest-sugar"]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.0.0"
|
||||
description = "brain-dead simple config-ini parsing"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
|
||||
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "23.2"
|
||||
description = "Core utilities for Python packages"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"},
|
||||
{file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.3.0"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"},
|
||||
{file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
testing = ["pytest", "pytest-benchmark"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "7.4.0"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"},
|
||||
{file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
iniconfig = "*"
|
||||
packaging = "*"
|
||||
pluggy = ">=0.12,<2.0"
|
||||
|
||||
[package.extras]
|
||||
testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
|
||||
|
||||
[[package]]
|
||||
name = "smmap"
|
||||
version = "5.0.1"
|
||||
description = "A pure Python implementation of a sliding window memory map manager"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "smmap-5.0.1-py3-none-any.whl", hash = "sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da"},
|
||||
{file = "smmap-5.0.1.tar.gz", hash = "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62"},
|
||||
]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.11"
|
||||
content-hash = "74f2edc4f13d417cf488f33b42f1e0ef99293b4ddf0bf951c22cf671793c203a"
|
||||
21
tests/pyproject.toml
Normal file
21
tests/pyproject.toml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[tool.poetry]
|
||||
name = "git-extras-tests"
|
||||
version = "0.1.0"
|
||||
description = "tests for git extras"
|
||||
authors = ["vanpipy <vanpipy@gmail.com>"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
pytest = "7.4"
|
||||
gitpython = "3.1.40"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
minversion = "7.4"
|
||||
addopts = "-ra -q"
|
||||
testpaths = ["."]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
Loading…
Reference in a new issue