Skip to content

Commit 324a311

Browse files
author
Grzegorz Śliwiński
committed
Move most of package configuration to pyproject.toml - closes #704
1 parent e7e6ecc commit 324a311

12 files changed

Lines changed: 77 additions & 93 deletions

File tree

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
include *.rst *.py
2-
include pytest_postgresql/py.typed
1+
include *.rst *.py pytest_postgresql/py.typed
32
recursive-include pytest_postgresql *.py

newsfragments/704.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move most of package configuration to pyproject.toml

pyproject.toml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,74 @@
1+
[project]
2+
name = "pytest-postgresql"
3+
version = "4.1.1"
4+
description = "Postgresql fixtures and fixture factories for Pytest."
5+
readme = "README.rst"
6+
keywords = ["tests", "pytest", "fixture", "postgresql"]
7+
license = {file = "LICENSE"}
8+
authors = [
9+
{name = "Grzegorz Śliwiński", email = "fizyk+pypi@fizyk.dev"}
10+
]
11+
classifiers = [
12+
"Development Status :: 5 - Production/Stable",
13+
"Environment :: Web Environment",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
16+
"Natural Language :: English",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.8",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3 :: Only",
25+
"Topic :: Software Development :: Libraries :: Python Modules",
26+
"Topic :: Software Development :: Testing",
27+
"Framework :: Pytest",
28+
]
29+
dependencies = [
30+
"pytest >= 6.2",
31+
"port-for >= 0.6.0",
32+
"mirakuru",
33+
"setuptools",
34+
]
35+
requires-python = ">= 3.8"
36+
37+
[project.urls]
38+
"Source" = "https://github.com/ClearcodeHQ/pytest-postgresql"
39+
"Bug Tracker" = "https://github.com/ClearcodeHQ/pytest-postgresql/issues"
40+
"Changelog" = "https://github.com/ClearcodeHQ/pytest-postgresql/blob/v4.1.1/CHANGES.rst"
41+
42+
[project.entry-points."pytest11"]
43+
pytest_redis = "pytest_postgresql.plugin"
44+
145
[build-system]
2-
requires = ["setuptools >= 40.6.0", "wheel"]
46+
requires = ["setuptools >= 61.0.0", "wheel"]
347
build-backend = "setuptools.build_meta"
448

49+
[tool.setuptools]
50+
zip-safe = true
51+
52+
[tool.setuptools.packages.find]
53+
include = ["pytest_postgresql*"]
54+
exclude = ["tests*"]
55+
namespaces = false
56+
57+
[tool.pytest.ini_options]
58+
xfail_strict=true
59+
addopts = "--max-worker-restart=0 --showlocals --verbose --cov"
60+
testpaths = "tests"
61+
pytester_example_dir = "tests/examples"
62+
norecursedirs = "examples"
63+
564
[tool.black]
665
line-length = 100
766
target-version = ['py39']
867
include = '.*\.pyi?$'
968

69+
[tool.pydocstyle]
70+
ignore = "D203,D212"
71+
1072
[tool.towncrier]
1173
directory = "newsfragments"
1274
single_file=true

pytest_postgresql/compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
def check_for_psycopg() -> None:
2929
"""
30-
Function checks whether psycopg was imported.
30+
Check whether psycopg was imported.
3131
3232
Raises ImportError if not.
3333
"""

pytest_postgresql/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
"""Plugin's configuration."""
12
from typing import Optional, TypedDict, Any, List
23

34
from pytest import FixtureRequest
45

56

67
class PostgresqlConfigDict(TypedDict):
8+
"""Typed Config dictionary."""
9+
710
exec: str
811
host: str
912
port: Optional[str]

pytest_postgresql/factories/noprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
def xdistify_dbname(dbname: str) -> str:
31-
"""Modified the database name depending on the presence and usage of xdist."""
31+
"""Modify the database name depending on the presence and usage of xdist."""
3232
xdist_worker = os.getenv("PYTEST_XDIST_WORKER")
3333
if xdist_worker:
3434
return f"{dbname}{xdist_worker}"

pytest_postgresql/janitor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _terminate_connection(cur: cursor, dbname: str) -> None:
106106

107107
def load(self, load: Union[Callable, str]) -> None:
108108
"""
109-
Loads data into a database.
109+
Load data into a database.
110110
111111
Either runs a passed loader if it's callback,
112112
or runs predefined loader if it's sql file.
@@ -157,6 +157,7 @@ def connect() -> connection:
157157
conn.close()
158158

159159
def __enter__(self: DatabaseJanitorType) -> DatabaseJanitorType:
160+
"""Initialize Database Janitor."""
160161
self.init()
161162
return self
162163

@@ -166,4 +167,5 @@ def __exit__(
166167
exc_val: Optional[BaseException],
167168
exc_tb: Optional[TracebackType],
168169
) -> None:
170+
"""Exit from Database janitor context cleaning after itself."""
169171
self.drop()

pytest_postgresql/retry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Small retry callable in case of specific error occurred"""
1+
"""Small retry callable in case of specific error occurred."""
22

33
from datetime import datetime, timedelta
44
from time import sleep

pytest_postgresql/sql.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
"""SQL Loader function."""
12
from typing import Any
23

34
from pytest_postgresql.compat import psycopg
45

56

67
def loader(sql_filename: str, **kwargs: Any) -> None:
7-
"""Database loader for sql files"""
8+
"""Database loader for sql files."""
89
db_connection = psycopg.connect(**kwargs)
910
with open(sql_filename, "r") as _fd:
1011
with db_connection.cursor() as cur:

setup.cfg

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,3 @@
1-
[metadata]
2-
name = pytest-postgresql
3-
version = 4.1.1
4-
url = https://github.com/ClearcodeHQ/pytest-postgresql
5-
description = Postgresql fixtures and fixture factories for Pytest.
6-
long_description = file: README.rst, CHANGES.rst
7-
long_description_content_type = text/x-rst
8-
keywords = tests, py.test, pytest, fixture, postgresql
9-
license = LGPLv3+
10-
maintainer = Grzegorz Śliwiński
11-
maintainer_email = fizyk+pypi@fizyk.net.pl
12-
classifiers =
13-
Development Status :: 5 - Production/Stable
14-
Environment :: Web Environment
15-
Intended Audience :: Developers
16-
License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
17-
Natural Language :: English
18-
Operating System :: OS Independent
19-
Programming Language :: Python
20-
Programming Language :: Python :: 3
21-
Programming Language :: Python :: 3.8
22-
Programming Language :: Python :: 3.9
23-
Programming Language :: Python :: 3.10
24-
Programming Language :: Python :: 3.11
25-
Programming Language :: Python :: 3 :: Only
26-
Topic :: Software Development :: Libraries :: Python Modules
27-
Topic :: Software Development :: Testing
28-
Framework :: Pytest
29-
30-
[options]
31-
zip_safe = False
32-
include_package_data = True
33-
python_requires = >= 3.8
34-
packages = pytest_postgresql
35-
install_requires =
36-
pytest>=6.2.0
37-
port-for
38-
mirakuru>=2.3.0
39-
setuptools
40-
41-
[options.entry_points]
42-
pytest11 =
43-
pytest_postgresql = pytest_postgresql.plugin
44-
45-
[options.package_data]
46-
pytest_postgresql = py.typed
47-
48-
[options.extras_require]
49-
tests =
50-
pytest-cov
51-
pytest-xdist
52-
531
[flake8]
542
max-line-length = 100
553
exclude = docs/*,build/*,venv/*
56-
57-
[pydocstyle]
58-
ignore = D203,D212
59-
match = '(?!docs|build|venv).*\.py'
60-
61-
[tool:pytest]
62-
addopts = --max-worker-restart=0 --showlocals --verbose --cov pytest_postgresql --cov tests
63-
testpaths = tests
64-
xfail_strict = true
65-
pytester_example_dir = tests/examples
66-
norecursedirs=examples

0 commit comments

Comments
 (0)