pytest-postgresql 7.0.0__tar.gz → 7.0.1__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.1}/CHANGES.rst +13 -0
  2. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/PKG-INFO +2 -2
  3. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pyproject.toml +3 -3
  4. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/__init__.py +1 -1
  5. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/config.py +4 -1
  6. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/loader.py +5 -5
  7. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/PKG-INFO +2 -2
  8. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/SOURCES.txt +1 -0
  9. pytest_postgresql-7.0.1/tests/test_config.py +22 -0
  10. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_postgres_options_plugin.py +9 -0
  11. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/AUTHORS.rst +0 -0
  12. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/CONTRIBUTING.rst +0 -0
  13. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/COPYING +0 -0
  14. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/COPYING.lesser +0 -0
  15. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/MANIFEST.in +0 -0
  16. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/README.rst +0 -0
  17. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/exceptions.py +0 -0
  18. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/executor.py +0 -0
  19. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/executor_noop.py +0 -0
  20. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/__init__.py +0 -0
  21. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/client.py +0 -0
  22. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/noprocess.py +0 -0
  23. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/process.py +0 -0
  24. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/janitor.py +0 -0
  25. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/plugin.py +0 -0
  26. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/py.typed +0 -0
  27. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql/retry.py +0 -0
  28. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/dependency_links.txt +0 -0
  29. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/entry_points.txt +0 -0
  30. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/requires.txt +0 -0
  31. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/top_level.txt +0 -0
  32. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/zip-safe +0 -0
  33. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/setup.cfg +0 -0
  34. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_executor.py +0 -0
  35. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_janitor.py +0 -0
  36. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_loader.py +0 -0
  37. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_noopexecutor.py +0 -0
  38. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_postgresql.py +0 -0
  39. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_template_database.py +0 -0
  40. {pytest_postgresql-7.0.0 → pytest_postgresql-7.0.1}/tests/test_version.py +0 -0
@@ -3,6 +3,19 @@ CHANGELOG
3
3
 
4
4
  .. towncrier release notes start
5
5
 
6
+ 7.0.1 (2025-03-19)
7
+ ==================
8
+
9
+ Bugfixes
10
+ --------
11
+
12
+ - Close postgresql connection after loading sql files.
13
+
14
+ Fixes possible `ResourceWarning`
15
+ - Fixed an issue, where defining load paths in ini/toml configuration would fail
16
+ due to pytest's LocalPath not having an endswith method.
17
+
18
+
6
19
  7.0.0 (2025-02-23)
7
20
  ==================
8
21
 
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pytest-postgresql
3
- Version: 7.0.0
3
+ Version: 7.0.1
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.1/CHANGES.rst
9
9
  Keywords: tests,pytest,fixture,postgresql
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Web Environment
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pytest-postgresql"
3
- version = "7.0.0"
3
+ version = "7.0.1"
4
4
  description = "Postgresql fixtures and fixture factories for Pytest."
5
5
  readme = "README.rst"
6
6
  keywords = ["tests", "pytest", "fixture", "postgresql"]
@@ -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.1/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.1"
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.1"
@@ -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
 
@@ -50,10 +51,12 @@ def get_config(request: FixtureRequest) -> PostgresqlConfigDict:
50
51
  )
51
52
 
52
53
 
53
- def detect_paths(load_paths: List[str]) -> List[Union[Path, str]]:
54
+ def detect_paths(load_paths: List[Union[LocalPath, str]]) -> List[Union[Path, str]]:
54
55
  """Convert path to sql files to Path instances."""
55
56
  converted_load_paths: List[Union[Path, str]] = []
56
57
  for path in load_paths:
58
+ if isinstance(path, LocalPath):
59
+ path = str(path)
57
60
  if path.endswith(".sql"):
58
61
  converted_load_paths.append(Path(path))
59
62
  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()
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pytest-postgresql
3
- Version: 7.0.0
3
+ Version: 7.0.1
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.1/CHANGES.rst
9
9
  Keywords: tests,pytest,fixture,postgresql
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Web Environment
@@ -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
@@ -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,15 @@ 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
+
51
60
  postgresql_proc_to_override = postgresql_proc()
52
61
 
53
62