pytest-postgresql 7.0.0__tar.gz → 7.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/CHANGES.rst +32 -0
  2. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/PKG-INFO +5 -4
  3. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pyproject.toml +4 -4
  4. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/__init__.py +1 -1
  5. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/config.py +6 -2
  6. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/loader.py +5 -5
  7. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/plugin.py +1 -1
  8. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql.egg-info/PKG-INFO +5 -4
  9. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql.egg-info/SOURCES.txt +1 -0
  10. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql.egg-info/requires.txt +1 -1
  11. pytest_postgresql-7.0.2/tests/test_config.py +22 -0
  12. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_postgres_options_plugin.py +26 -0
  13. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/AUTHORS.rst +0 -0
  14. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/CONTRIBUTING.rst +0 -0
  15. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/COPYING +0 -0
  16. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/COPYING.lesser +0 -0
  17. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/MANIFEST.in +0 -0
  18. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/README.rst +0 -0
  19. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/exceptions.py +0 -0
  20. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/executor.py +0 -0
  21. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/executor_noop.py +0 -0
  22. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/factories/__init__.py +0 -0
  23. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/factories/client.py +0 -0
  24. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/factories/noprocess.py +0 -0
  25. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/factories/process.py +0 -0
  26. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/janitor.py +0 -0
  27. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/py.typed +0 -0
  28. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql/retry.py +0 -0
  29. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql.egg-info/dependency_links.txt +0 -0
  30. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql.egg-info/entry_points.txt +0 -0
  31. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql.egg-info/top_level.txt +0 -0
  32. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/pytest_postgresql.egg-info/zip-safe +0 -0
  33. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/setup.cfg +0 -0
  34. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_executor.py +0 -0
  35. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_janitor.py +0 -0
  36. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_loader.py +0 -0
  37. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_noopexecutor.py +0 -0
  38. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_postgresql.py +0 -0
  39. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_template_database.py +0 -0
  40. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.2}/tests/test_version.py +0 -0
@@ -3,6 +3,38 @@ CHANGELOG
3
3
 
4
4
  .. towncrier release notes start
5
5
 
6
+ 7.0.2 (2025-05-17)
7
+ ==================
8
+
9
+ Bugfixes
10
+ --------
11
+
12
+ - Fix an issue where number of search counts has been hard-default set to 5 by command-line default and ini setting could not override it. (`#1115 <https://github.com/dbfixtures/pytest-postgresql/issues/1115>`__)
13
+ - Update minimum required pytest version to 7.2
14
+
15
+ Additionally added test run of `pytest-postgresql` against oldest supported versions. (`#1131 <https://github.com/dbfixtures/pytest-postgresql/issues/1131>`__)
16
+
17
+
18
+ Miscellaneus
19
+ ------------
20
+
21
+ - Different approach to oldest requirements file. Trying to get dependabot off of it.
22
+ - Test pipeline optimisations
23
+
24
+
25
+ 7.0.1 (2025-03-19)
26
+ ==================
27
+
28
+ Bugfixes
29
+ --------
30
+
31
+ - Close postgresql connection after loading sql files.
32
+
33
+ Fixes possible `ResourceWarning`
34
+ - Fixed an issue, where defining load paths in ini/toml configuration would fail
35
+ due to pytest's LocalPath not having an endswith method.
36
+
37
+
6
38
  7.0.0 (2025-02-23)
7
39
  ==================
8
40
 
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: pytest-postgresql
3
- Version: 7.0.0
3
+ Version: 7.0.2
4
4
  Summary: Postgresql fixtures and fixture factories for Pytest.
5
5
  Author-email: Grzegorz Śliwiński <fizyk+pypi@fizyk.dev>
6
6
  Project-URL: Source, https://github.com/dbfixtures/pytest-postgresql
7
7
  Project-URL: Bug Tracker, https://github.com/dbfixtures/pytest-postgresql/issues
8
- Project-URL: Changelog, https://github.com/dbfixtures/pytest-postgresql/blob/v7.0.0/CHANGES.rst
8
+ Project-URL: Changelog, https://github.com/dbfixtures/pytest-postgresql/blob/v7.0.2/CHANGES.rst
9
9
  Keywords: tests,pytest,fixture,postgresql
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Web Environment
@@ -29,11 +29,12 @@ Description-Content-Type: text/x-rst
29
29
  License-File: COPYING
30
30
  License-File: COPYING.lesser
31
31
  License-File: AUTHORS.rst
32
- Requires-Dist: pytest>=6.2
32
+ Requires-Dist: pytest>=7.2
33
33
  Requires-Dist: port-for>=0.7.3
34
34
  Requires-Dist: mirakuru>=2.6.0
35
35
  Requires-Dist: packaging
36
36
  Requires-Dist: psycopg>=3.0.0
37
+ Dynamic: license-file
37
38
 
38
39
  .. image:: https://raw.githubusercontent.com/dbfixtures/pytest-postgresql/master/logo.png
39
40
  :width: 100px
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pytest-postgresql"
3
- version = "7.0.0"
3
+ version = "7.0.2"
4
4
  description = "Postgresql fixtures and fixture factories for Pytest."
5
5
  readme = "README.rst"
6
6
  keywords = ["tests", "pytest", "fixture", "postgresql"]
@@ -28,7 +28,7 @@ classifiers = [
28
28
  "Framework :: Pytest",
29
29
  ]
30
30
  dependencies = [
31
- "pytest >= 6.2",
31
+ "pytest >= 7.2",
32
32
  "port-for >= 0.7.3",
33
33
  "mirakuru >= 2.6.0",
34
34
  "packaging",
@@ -39,7 +39,7 @@ requires-python = ">= 3.9"
39
39
  [project.urls]
40
40
  "Source" = "https://github.com/dbfixtures/pytest-postgresql"
41
41
  "Bug Tracker" = "https://github.com/dbfixtures/pytest-postgresql/issues"
42
- "Changelog" = "https://github.com/dbfixtures/pytest-postgresql/blob/v7.0.0/CHANGES.rst"
42
+ "Changelog" = "https://github.com/dbfixtures/pytest-postgresql/blob/v7.0.2/CHANGES.rst"
43
43
 
44
44
  [project.entry-points."pytest11"]
45
45
  pytest_postgresql = "pytest_postgresql.plugin"
@@ -107,7 +107,7 @@ name = "Miscellaneus"
107
107
  showcontent = false
108
108
 
109
109
  [tool.tbump.version]
110
- current = "7.0.0"
110
+ current = "7.0.2"
111
111
 
112
112
  # Example of a semver regexp.
113
113
  # Make sure this matches current_version before
@@ -18,4 +18,4 @@
18
18
  # along with pytest-postgresql. If not, see <http://www.gnu.org/licenses/>.
19
19
  """Main module for pytest-postgresql."""
20
20
 
21
- __version__ = "7.0.0"
21
+ __version__ = "7.0.2"
@@ -3,6 +3,7 @@
3
3
  from pathlib import Path
4
4
  from typing import Any, List, Optional, TypedDict, Union
5
5
 
6
+ from _pytest._py.path import LocalPath
6
7
  from pytest import FixtureRequest
7
8
 
8
9
 
@@ -37,7 +38,8 @@ def get_config(request: FixtureRequest) -> PostgresqlConfigDict:
37
38
  exec=get_postgresql_option("exec"),
38
39
  host=get_postgresql_option("host"),
39
40
  port=get_postgresql_option("port"),
40
- port_search_count=get_postgresql_option("port_search_count"),
41
+ # Parse as int, because if it's defined in an INI file then it'll always be a string
42
+ port_search_count=int(get_postgresql_option("port_search_count")),
41
43
  user=get_postgresql_option("user"),
42
44
  password=get_postgresql_option("password"),
43
45
  options=get_postgresql_option("options"),
@@ -50,10 +52,12 @@ def get_config(request: FixtureRequest) -> PostgresqlConfigDict:
50
52
  )
51
53
 
52
54
 
53
- def detect_paths(load_paths: List[str]) -> List[Union[Path, str]]:
55
+ def detect_paths(load_paths: List[Union[LocalPath, str]]) -> List[Union[Path, str]]:
54
56
  """Convert path to sql files to Path instances."""
55
57
  converted_load_paths: List[Union[Path, str]] = []
56
58
  for path in load_paths:
59
+ if isinstance(path, LocalPath):
60
+ path = str(path)
57
61
  if path.endswith(".sql"):
58
62
  converted_load_paths.append(Path(path))
59
63
  else:
@@ -25,8 +25,8 @@ def build_loader(load: Union[Callable, str, Path]) -> Callable:
25
25
 
26
26
  def sql(sql_filename: Path, **kwargs: Any) -> None:
27
27
  """Database loader for sql files."""
28
- db_connection = psycopg.connect(**kwargs)
29
- with open(sql_filename, "r") as _fd:
30
- with db_connection.cursor() as cur:
31
- cur.execute(_fd.read())
32
- db_connection.commit()
28
+ with psycopg.connect(**kwargs) as db_connection:
29
+ with open(sql_filename, "r") as _fd:
30
+ with db_connection.cursor() as cur:
31
+ cur.execute(_fd.read())
32
+ db_connection.commit()
@@ -16,6 +16,7 @@
16
16
  # You should have received a copy of the GNU Lesser General Public License
17
17
  # along with pytest-postgresql. If not, see <http://www.gnu.org/licenses/>.
18
18
  """Plugin module of pytest-postgresql."""
19
+
19
20
  from tempfile import gettempdir
20
21
 
21
22
  from _pytest.config.argparsing import Parser
@@ -92,7 +93,6 @@ def pytest_addoption(parser: Parser) -> None:
92
93
  action="store",
93
94
  dest="postgresql_port_search_count",
94
95
  help=_help_port_search_count,
95
- default=5,
96
96
  )
97
97
 
98
98
  parser.addoption("--postgresql-user", action="store", dest="postgresql_user", help=_help_user)
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: pytest-postgresql
3
- Version: 7.0.0
3
+ Version: 7.0.2
4
4
  Summary: Postgresql fixtures and fixture factories for Pytest.
5
5
  Author-email: Grzegorz Śliwiński <fizyk+pypi@fizyk.dev>
6
6
  Project-URL: Source, https://github.com/dbfixtures/pytest-postgresql
7
7
  Project-URL: Bug Tracker, https://github.com/dbfixtures/pytest-postgresql/issues
8
- Project-URL: Changelog, https://github.com/dbfixtures/pytest-postgresql/blob/v7.0.0/CHANGES.rst
8
+ Project-URL: Changelog, https://github.com/dbfixtures/pytest-postgresql/blob/v7.0.2/CHANGES.rst
9
9
  Keywords: tests,pytest,fixture,postgresql
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Web Environment
@@ -29,11 +29,12 @@ Description-Content-Type: text/x-rst
29
29
  License-File: COPYING
30
30
  License-File: COPYING.lesser
31
31
  License-File: AUTHORS.rst
32
- Requires-Dist: pytest>=6.2
32
+ Requires-Dist: pytest>=7.2
33
33
  Requires-Dist: port-for>=0.7.3
34
34
  Requires-Dist: mirakuru>=2.6.0
35
35
  Requires-Dist: packaging
36
36
  Requires-Dist: psycopg>=3.0.0
37
+ Dynamic: license-file
37
38
 
38
39
  .. image:: https://raw.githubusercontent.com/dbfixtures/pytest-postgresql/master/logo.png
39
40
  :width: 100px
@@ -27,6 +27,7 @@ pytest_postgresql/factories/__init__.py
27
27
  pytest_postgresql/factories/client.py
28
28
  pytest_postgresql/factories/noprocess.py
29
29
  pytest_postgresql/factories/process.py
30
+ tests/test_config.py
30
31
  tests/test_executor.py
31
32
  tests/test_janitor.py
32
33
  tests/test_loader.py
@@ -1,4 +1,4 @@
1
- pytest>=6.2
1
+ pytest>=7.2
2
2
  port-for>=0.7.3
3
3
  mirakuru>=2.6.0
4
4
  packaging
@@ -0,0 +1,22 @@
1
+ """Config tests."""
2
+
3
+ from pathlib import Path
4
+ from typing import Union
5
+
6
+ import pytest
7
+ from _pytest._py.path import LocalPath
8
+
9
+ from pytest_postgresql.config import detect_paths
10
+
11
+
12
+ @pytest.mark.parametrize(
13
+ "path, want",
14
+ (
15
+ ("test.sql", Path("test.sql")),
16
+ ("load.function", "load.function"),
17
+ (LocalPath("test.sql"), Path("test.sql").absolute()), # type: ignore[no-untyped-call]
18
+ ),
19
+ )
20
+ def test_detect_paths(path: Union[str, LocalPath], want: Union[Path, str]) -> None:
21
+ """Check the correctness of detect_paths function."""
22
+ assert detect_paths([path]) == [want]
@@ -48,6 +48,32 @@ def test_postgres_loader_in_cli(pointed_pytester: Pytester) -> None:
48
48
  ret.assert_outcomes(passed=1)
49
49
 
50
50
 
51
+ def test_postgres_loader_in_ini(pointed_pytester: Pytester) -> None:
52
+ """Check that pytest.ini arguments are honored for load."""
53
+ pointed_pytester.copy_example("test_load.py")
54
+ test_sql_path = pointed_pytester.copy_example("test.sql")
55
+ pointed_pytester.makefile(".ini", pytest=f"[pytest]\npostgresql_load = {test_sql_path}\n")
56
+ ret = pointed_pytester.runpytest("test_load.py")
57
+ ret.assert_outcomes(passed=1)
58
+
59
+
60
+ def test_postgres_port_search_count_in_cli_is_int(pointed_pytester: Pytester) -> None:
61
+ """Check that the --postgresql-port-search-count command line argument is parsed as an int."""
62
+ pointed_pytester.copy_example("test_assert_port_search_count_is_ten.py")
63
+ ret = pointed_pytester.runpytest(
64
+ "--postgresql-port-search-count", "10", "test_assert_port_search_count_is_ten.py"
65
+ )
66
+ ret.assert_outcomes(passed=1)
67
+
68
+
69
+ def test_postgres_port_search_count_in_ini_is_int(pointed_pytester: Pytester) -> None:
70
+ """Check that pytest.ini arguments are honored for load."""
71
+ pointed_pytester.copy_example("test_assert_port_search_count_is_ten.py")
72
+ pointed_pytester.makefile(".ini", pytest="[pytest]\npostgresql_port_search_count = 10\n")
73
+ ret = pointed_pytester.runpytest("test_assert_port_search_count_is_ten.py")
74
+ ret.assert_outcomes(passed=1)
75
+
76
+
51
77
  postgresql_proc_to_override = postgresql_proc()
52
78
 
53
79