Skip to content

Commit

Permalink
Support python 3.12
Browse files Browse the repository at this point in the history
Remove python 3.7 support and pytest 4 support.
  • Loading branch information
Antoine DECHAUME committed Oct 7, 2023
1 parent 083c40a commit 2533e0a
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 147 deletions.
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
plugins = covdefaults
source = pytest_executable

[report]
# Override covdefaults.
fail_under = 90
18 changes: 18 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[flake8]
# See http://www.pydocstyle.org/en/latest/error_codes.html for more details.
ignore =
# D105 Missing docstring in magic method
D105,
# D107 Missing docstring in __init__: because we use google style docstring in class.
D107,
# D413 Missing blank line after last section: see above.
D413,
# E501 line too long, use bugbear warning instead, see https://github.com/psf/black#line-length
E501,
exclude = tests/data
max-line-length = 88
select = B,C,D,E,F,G,N,T,W,B950
docstring-convention = google
per-file-ignores =
conf.py:D
tests/**/*.py:D
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Setup Python
Expand Down
2 changes: 2 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
strict = True
31 changes: 14 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/PyCQA/autoflake
rev: v2.0.2
rev: v2.2.1
hooks:
- id: autoflake
args: [
Expand All @@ -29,14 +29,14 @@ repos:
]

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
rev: v3.12.0
hooks:
- id: reorder-python-imports
name: reorder python imports inside src
args: [
--application-directories,
src,
--py37-plus,
--py38-plus,
--add-import,
"from __future__ import annotations",
]
Expand All @@ -45,48 +45,45 @@ repos:
name: reorder python imports outside src
exclude: ^src
args: [
--py37-plus,
--py38-plus,
--add-import,
"from __future__ import annotations",
]

- repo: https://github.com/myint/docformatter
rev: v1.5.1
rev: v1.7.5
hooks:
- id: docformatter
exclude: ^tests/.*$
args: [
--in-place,
--wrap-summaries,
"89",
--wrap-descriptions,
"89",
--black,
]

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.14.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.9.1
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==22.12.6
- flake8-docstrings==1.6.0
- flake8-bugbear==23.7.10
- flake8-docstrings==1.7.0
- flake8-logging-format==0.9.0
- flake8-print==5.0.0
- pep8-naming==0.13.3

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.5.1
hooks:
- id: mypy
exclude: ^(report-conf|tests|doc)
Expand All @@ -98,7 +95,7 @@ repos:
- types-pytest-lazy-fixture

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
rev: v1.5.4
hooks:
- id: insert-license
name: insert apache license
Expand Down
57 changes: 55 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,64 @@
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
"wheel",
]
build-backend = "setuptools.build_meta"

[project]
name = "pytest-executable"
description = "pytest plugin for testing executables"
readme = "README.rst"
authors = [
{name = "Antoine Dechaume"},
]
classifiers = [
"Environment :: Console",
"Framework :: Pytest",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Testing",
"Topic :: Utilities",
]
dynamic = ["version"]
requires-python = ">=3.8,<3.13"
dependencies = [
"delta >=0.4,<0.5",
"jinja2 >=2.7,<3.2",
"jsonschema >=2,<5",
"pytest >=5,<8",
"pyyaml >=3,<6.1",
]
license = {text = "Apache Software License 2.0"}

[project.urls]
Homepage = "https://www.github.com/CS-SI/pytest-executable"

[project.optional-dependencies]
test = [
"covdefaults",
"pytest-cov",
]

[project.entry-points.pytest11]
pytest_executable = "pytest_executable.plugin"

[tool.setuptools_scm]

[tool.setuptools]
license-files = [
"LICENSE.txt",
"CREDITS.md",
]

[tool.black]
target-version = ['py37']
target-version = ['py38']
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
testpaths = tests
addopts = --ignore tests/data
filterwarnings =
ignore::pytest.PytestExperimentalApiWarning
93 changes: 0 additions & 93 deletions setup.cfg

This file was deleted.

26 changes: 0 additions & 26 deletions setup.py

This file was deleted.

8 changes: 4 additions & 4 deletions src/pytest_executable/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@


def _get_path(obj: Any) -> Path | LEGACY_PATH:
if PYTEST_USE_FSPATH:
if PYTEST_USE_FSPATH: # pragma: no cover
return obj.fspath
else:
return obj.path
Expand Down Expand Up @@ -323,7 +323,7 @@ def pytest_generate_tests(metafunc: Metafunc) -> None:
)


if PYTEST_USE_FSPATH:
if PYTEST_USE_FSPATH: # pragma: no cover

def pytest_collect_file(
parent: Collector,
Expand Down Expand Up @@ -388,14 +388,14 @@ def _getobj(self) -> ModuleType:

# backup the attribute before a temporary override of it
path = _get_path(self)
if PYTEST_USE_FSPATH:
if PYTEST_USE_FSPATH: # pragma: no cover
self.fspath = py.path.local(test_module_path)
else:
self.path = test_module_path
module: ModuleType = self._importtestmodule() # type: ignore

# restore the backed up attribute
if PYTEST_USE_FSPATH:
if PYTEST_USE_FSPATH: # pragma: no cover
self.fspath = path
else:
self.path = path
Expand Down
3 changes: 2 additions & 1 deletion src/pytest_executable/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# limitations under the License.
"""Provides the container for the settings of a test case.
We use a dataclass because a dictionary does not offer easy checking and code completion.
We use a dataclass because a dictionary does not offer easy checking and code
completion.
"""
from __future__ import annotations

Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[tox]
env_list =
py{37,38,39,310,311}-pytest{4,5,6,7}
py{38,39,310,311,312}-pytest{5,6,7}

[testenv]
package = wheel
wheel_build_env = {package_env}
deps =
pytest4: pytest==4.*
pytest5: pytest==5.*
pytest6: pytest==6.*
pytest7: pytest==7.*
coverage: pytest-cov
extras = test
set_env =
coverage: __COVERAGE_POSARGS=--cov-config setup.cfg --cov --cov-report=xml
coverage: __COVERAGE_POSARGS=--cov --cov-report=xml
commands =
pytest {env:__COVERAGE_POSARGS:} {posargs}

Expand Down

0 comments on commit 2533e0a

Please sign in to comment.