pytest-postgresql 6.1.1__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 (41) hide show
  1. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/AUTHORS.rst +1 -1
  2. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/CHANGES.rst +112 -43
  3. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/CONTRIBUTING.rst +16 -6
  4. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/COPYING +1 -1
  5. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/COPYING.lesser +1 -1
  6. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/PKG-INFO +57 -51
  7. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/README.rst +48 -42
  8. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pyproject.toml +12 -13
  9. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/__init__.py +1 -1
  10. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/config.py +8 -1
  11. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/executor.py +2 -2
  12. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/client.py +8 -21
  13. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/noprocess.py +6 -2
  14. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/process.py +34 -5
  15. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/janitor.py +2 -2
  16. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/loader.py +6 -6
  17. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/plugin.py +21 -0
  18. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/PKG-INFO +57 -51
  19. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/SOURCES.txt +1 -0
  20. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/requires.txt +2 -2
  21. pytest_postgresql-7.0.1/tests/test_config.py +22 -0
  22. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/tests/test_executor.py +2 -2
  23. pytest_postgresql-7.0.1/tests/test_postgres_options_plugin.py +132 -0
  24. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/tests/test_postgresql.py +3 -12
  25. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/tests/test_template_database.py +1 -0
  26. pytest_postgresql-6.1.1/tests/test_postgres_options_plugin.py +0 -43
  27. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/MANIFEST.in +0 -0
  28. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/exceptions.py +0 -0
  29. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/executor_noop.py +0 -0
  30. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/factories/__init__.py +0 -0
  31. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/py.typed +0 -0
  32. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql/retry.py +0 -0
  33. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/dependency_links.txt +0 -0
  34. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/entry_points.txt +0 -0
  35. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/top_level.txt +0 -0
  36. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/pytest_postgresql.egg-info/zip-safe +0 -0
  37. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/setup.cfg +0 -0
  38. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/tests/test_janitor.py +0 -0
  39. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/tests/test_loader.py +0 -0
  40. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/tests/test_noopexecutor.py +0 -0
  41. {pytest_postgresql-6.1.1 → pytest_postgresql-7.0.1}/tests/test_version.py +0 -0
@@ -17,4 +17,4 @@ of pytest-postgresql along its history.
17
17
  * Donald Stufft
18
18
  * Will Vaughn
19
19
  * Hugo (hugovk)
20
- * Damian Skrzypczak
20
+ * Damian Skrzypczak
@@ -3,13 +3,82 @@ 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
+
19
+ 7.0.0 (2025-02-23)
20
+ ==================
21
+
22
+ Breaking changes
23
+ ----------------
24
+
25
+ - Drop support for load parameter from client fixtures. This can be easily replaced by creating intermediary fixture between test and client fixture. (`#1087 <https://github.com/dbfixtures/pytest-postgresql/issues/1087>`__)
26
+ - Stop supporting Python 3.8 as it already reached EOL
27
+
28
+
29
+ Bugfixes
30
+ --------
31
+
32
+ - Passing all environment variables to the initdb.
33
+
34
+ This helps the cases where og_ctl is replaced by custom shell script
35
+ making additional calls, and needs all the variables, that ie server process gets. (`#1076 <https://github.com/dbfixtures/pytest-postgresql/issues/1076>`__)
36
+
37
+
38
+ Features
39
+ --------
40
+
41
+ - If a test run ended in an error that prevented proper test cleanup,
42
+ developer can now use `--postgresql-drop-test-database` command line flag,
43
+ to delete database from noproc fixture at the start. (`#265 <https://github.com/dbfixtures/pytest-postgresql/issues/265>`__)
44
+ - DatabaseJanitor.cursor now accepts optional parameter dbname, which defaults to `postgres`
45
+
46
+ This database name is used to make connection to and return a cursor. (`#265 <https://github.com/dbfixtures/pytest-postgresql/issues/265>`__)
47
+ - When running tests with xdist, pytest-postgresql now attempts to detect random ports
48
+ selected by other nodes by writing down a .port file in session temporary directory.
49
+
50
+ The number of tries it attempts to select unused port is configurable,
51
+ and defaults to 0.
52
+
53
+ In case pytest-postgresql won't be able to select unused port,
54
+ PortForException is thrown with appropriate message. (`#872 <https://github.com/dbfixtures/pytest-postgresql/issues/872>`__)
55
+ - Mark Python 3.13 as supported.
56
+
57
+
58
+ Miscellaneus
59
+ ------------
60
+
61
+ - `#707 <https://github.com/dbfixtures/pytest-postgresql/issues/707>`__, `#895 <https://github.com/dbfixtures/pytest-postgresql/issues/895>`__, `#1047 <https://github.com/dbfixtures/pytest-postgresql/issues/1047>`__, `#1048 <https://github.com/dbfixtures/pytest-postgresql/issues/1048>`__, `#1055 <https://github.com/dbfixtures/pytest-postgresql/issues/1055>`__, `#1061 <https://github.com/dbfixtures/pytest-postgresql/issues/1061>`__, `#1062 <https://github.com/dbfixtures/pytest-postgresql/issues/1062>`__, `#1063 <https://github.com/dbfixtures/pytest-postgresql/issues/1063>`__, `#1081 <https://github.com/dbfixtures/pytest-postgresql/issues/1081>`__
62
+ - Add PostgreSQL 17 to CI and drop 12
63
+ - Add [bot] suffix to the pre-commit actor.
64
+ - Adjust links after repository transfer
65
+ - Adjust workflows for actions-reuse 3.0.1
66
+ - Fix DatabaseJanitor documentation.
67
+ - In Python 3.13, usage of a positional argument for `maxsplit` has been
68
+ formally deprecated.
69
+ Update code to use keyword argument `maxsplit` instead of positional.
70
+ - Skip local hooks from ci
71
+ - Skip newsfragment checks for pre-commit actor.
72
+ - Update pre-commit configuration to use ruff instead of flake8/pydocstyle
73
+
74
+
6
75
  6.1.1 (2024-09-05)
7
76
  ==================
8
77
 
9
78
  Bugfixes
10
79
  --------
11
80
 
12
- - Set minimum version of `port-for` dependecy in pyproject.toml for client installations. (`#1015 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/1015>`__)
81
+ - Set minimum version of `port-for` dependecy in pyproject.toml for client installations. (`#1015 <https://github.com/dbfixtures/pytest-postgresql/issues/1015>`__)
13
82
 
14
83
 
15
84
  6.1.0 (2024-09-04)
@@ -18,13 +87,13 @@ Bugfixes
18
87
  Features
19
88
  --------
20
89
 
21
- - add support for \\ character in pytest temporary path (`#982 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/982>`__)
90
+ - add support for \\ character in pytest temporary path (`#982 <https://github.com/dbfixtures/pytest-postgresql/issues/982>`__)
22
91
 
23
92
 
24
93
  Miscellaneus
25
94
  ------------
26
95
 
27
- - Add test for `PR #965 <https://github.com/ClearcodeHQ/pytest-postgresql/pull/965>`_
96
+ - Add test for `PR #965 <https://github.com/dbfixtures/pytest-postgresql/pull/965>`_
28
97
  - refactors test_executor.py to enable Mac
29
98
 
30
99
 
@@ -35,13 +104,13 @@ Bugfixes
35
104
  --------
36
105
 
37
106
  - Fixed a long-standing bug, where calls to pg_ctl weren't getting `LC_*` and `LANG` envvars,
38
- which caused issues on some systems not recognizing --auth parameter. (`#343 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/343>`__)
107
+ which caused issues on some systems not recognizing --auth parameter. (`#343 <https://github.com/dbfixtures/pytest-postgresql/issues/343>`__)
39
108
 
40
109
 
41
110
  Miscellaneus
42
111
  ------------
43
112
 
44
- - `#945 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/945>`__
113
+ - `#945 <https://github.com/dbfixtures/pytest-postgresql/issues/945>`__
45
114
 
46
115
 
47
116
  6.0.0 (2024-03-11)
@@ -50,13 +119,13 @@ Miscellaneus
50
119
  Breaking changes
51
120
  ----------------
52
121
 
53
- - DatabaseJanitor class now accepts only keyword arguments. (`#899 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/899>`__)
122
+ - DatabaseJanitor class now accepts only keyword arguments. (`#899 <https://github.com/dbfixtures/pytest-postgresql/issues/899>`__)
54
123
 
55
124
 
56
125
  Bugfixes
57
126
  --------
58
127
 
59
- - Fix the remaining `DepcrecationWarning` for `datetime.datetime.utcnow` on Python 3.12. (`#896 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/896>`__)
128
+ - Fix the remaining `DepcrecationWarning` for `datetime.datetime.utcnow` on Python 3.12. (`#896 <https://github.com/dbfixtures/pytest-postgresql/issues/896>`__)
60
129
 
61
130
 
62
131
  Deprecations
@@ -65,7 +134,7 @@ Deprecations
65
134
  - Deprecated load parameter on a client fixture.
66
135
  Developers are encouraged to either use the load function/parameter
67
136
  for process fixture, or create an intermediate fixture placed between client
68
- and tests themselves to fill in the data. (`#850 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/850>`__)
137
+ and tests themselves to fill in the data. (`#850 <https://github.com/dbfixtures/pytest-postgresql/issues/850>`__)
69
138
 
70
139
 
71
140
  Features
@@ -73,18 +142,18 @@ Features
73
142
 
74
143
  - Now all sql files used to initialise database for tests, has to be passed as pathlib.Path instance.
75
144
 
76
- This helps the DatabaseJanitor choose correct behaviour based on parameter. (`#638 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/638>`__)
145
+ This helps the DatabaseJanitor choose correct behaviour based on parameter. (`#638 <https://github.com/dbfixtures/pytest-postgresql/issues/638>`__)
77
146
  - Have separate parameters for template database name and database name in DatabaseJanitor.
78
- It'll make it much clearer to understand the code and Janitor's behaviour. (`#672 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/672>`__)
147
+ It'll make it much clearer to understand the code and Janitor's behaviour. (`#672 <https://github.com/dbfixtures/pytest-postgresql/issues/672>`__)
79
148
  - Template databases are now created with is_template flag turned on, and not by setting allow_connections to false.
80
149
 
81
- The allow_connections flag being set to false is used strictly right before we attempt to drop the database. (`#914 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/914>`__)
150
+ The allow_connections flag being set to false is used strictly right before we attempt to drop the database. (`#914 <https://github.com/dbfixtures/pytest-postgresql/issues/914>`__)
82
151
 
83
152
 
84
153
  Miscellaneus
85
154
  ------------
86
155
 
87
- - `#865 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/865>`__, `#882 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/882>`__, `#893 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/893>`__, `#900 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/900>`__
156
+ - `#865 <https://github.com/dbfixtures/pytest-postgresql/issues/865>`__, `#882 <https://github.com/dbfixtures/pytest-postgresql/issues/882>`__, `#893 <https://github.com/dbfixtures/pytest-postgresql/issues/893>`__, `#900 <https://github.com/dbfixtures/pytest-postgresql/issues/900>`__
88
157
 
89
158
 
90
159
  5.1.1 (2024-03-07)
@@ -93,7 +162,7 @@ Miscellaneus
93
162
  Miscellaneus
94
163
  ------------
95
164
 
96
- - Add missing python 3.12 classifier to pythin package. (`#915 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/915>`__)
165
+ - Add missing python 3.12 classifier to pythin package. (`#915 <https://github.com/dbfixtures/pytest-postgresql/issues/915>`__)
97
166
 
98
167
 
99
168
  5.1.0 (2024-01-29)
@@ -102,26 +171,26 @@ Miscellaneus
102
171
  Bugfixes
103
172
  --------
104
173
 
105
- - Update postgresql_load default value for it to fallback into the empty list (`#881 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/881>`__)
174
+ - Update postgresql_load default value for it to fallback into the empty list (`#881 <https://github.com/dbfixtures/pytest-postgresql/issues/881>`__)
106
175
 
107
176
 
108
177
  Features
109
178
  --------
110
179
 
111
- - Support for Python 3.12 (`#835 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/835>`__)
180
+ - Support for Python 3.12 (`#835 <https://github.com/dbfixtures/pytest-postgresql/issues/835>`__)
112
181
 
113
182
 
114
183
  Miscellaneus
115
184
  ------------
116
185
 
117
- - Removed misleading parapgraph from one example in a README (`#688 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/688>`__)
118
- - Fixed typing exceptions for mypy 1.4 (`#765 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/765>`__)
119
- - README: fix section markup (`#771 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/771>`__, `#776 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/776>`__)
120
- - Add SQLAlchemy example for initialising common database state. (`#797 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/797>`__)
186
+ - Removed misleading parapgraph from one example in a README (`#688 <https://github.com/dbfixtures/pytest-postgresql/issues/688>`__)
187
+ - Fixed typing exceptions for mypy 1.4 (`#765 <https://github.com/dbfixtures/pytest-postgresql/issues/765>`__)
188
+ - README: fix section markup (`#771 <https://github.com/dbfixtures/pytest-postgresql/issues/771>`__, `#776 <https://github.com/dbfixtures/pytest-postgresql/issues/776>`__)
189
+ - Add SQLAlchemy example for initialising common database state. (`#797 <https://github.com/dbfixtures/pytest-postgresql/issues/797>`__)
121
190
  - Rely on cached/artifacted Pipfile.lock.
122
- That way, it will be specifically defined for given python version/system. (`#834 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/834>`__)
123
- - CI Change - Add PostgreSQL 16, drop PostgreSQL 11 (`#836 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/836>`__)
124
- - Replace usage of `pkg_resources.parse_version` with `packaging.version.parse` (`#858 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/858>`__)
191
+ That way, it will be specifically defined for given python version/system. (`#834 <https://github.com/dbfixtures/pytest-postgresql/issues/834>`__)
192
+ - CI Change - Add PostgreSQL 16, drop PostgreSQL 11 (`#836 <https://github.com/dbfixtures/pytest-postgresql/issues/836>`__)
193
+ - Replace usage of `pkg_resources.parse_version` with `packaging.version.parse` (`#858 <https://github.com/dbfixtures/pytest-postgresql/issues/858>`__)
125
194
 
126
195
 
127
196
  5.0.0 (2023-05-20)
@@ -130,7 +199,7 @@ Miscellaneus
130
199
  Breaking changes
131
200
  ----------------
132
201
 
133
- - Drop support for Python 3.7 (`#706 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/706>`__)
202
+ - Drop support for Python 3.7 (`#706 <https://github.com/dbfixtures/pytest-postgresql/issues/706>`__)
134
203
  - psycopg is now a mandatory requirement.
135
204
  With pyscop2 it was optional due to the different ways it could be installed:
136
205
 
@@ -138,32 +207,32 @@ Breaking changes
138
207
  * psycopg2-binary - binary distribution
139
208
  * psycopg2cffi - pypy enabled version
140
209
 
141
- Since psycopg version 3 there's only one package to install. (`#744 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/744>`__)
142
- - Dropped --postgresql-logsprefix/postgresql_logsprefix options. All fixture data is already distinguished by tmpdir itself. (`#748 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/748>`__)
210
+ Since psycopg version 3 there's only one package to install. (`#744 <https://github.com/dbfixtures/pytest-postgresql/issues/744>`__)
211
+ - Dropped --postgresql-logsprefix/postgresql_logsprefix options. All fixture data is already distinguished by tmpdir itself. (`#748 <https://github.com/dbfixtures/pytest-postgresql/issues/748>`__)
143
212
 
144
213
 
145
214
  Features
146
215
  --------
147
216
 
148
- - Re-rise FileNotFound errors with more meaningful messages. (`#598 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/598>`__)
149
- - Support Python 3.11 (`#678 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/678>`__)
217
+ - Re-rise FileNotFound errors with more meaningful messages. (`#598 <https://github.com/dbfixtures/pytest-postgresql/issues/598>`__)
218
+ - Support Python 3.11 (`#678 <https://github.com/dbfixtures/pytest-postgresql/issues/678>`__)
150
219
 
151
220
 
152
221
  Miscellaneus
153
222
  ------------
154
223
 
155
- - Drop PyPy from CI (`#669 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/669>`__)
156
- - pytest-postgresql will now recognise and use development postgresql versions (`#691 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/691>`__)
157
- - Use towncrier to maintain project's newsfragments/changelog (`#700 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/700>`__)
158
- - Move project dependency management to pipenv (`#701 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/701>`__)
159
- - Migrate to shared automerge workflow for automatic tests dependency updates (`#702 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/702>`__)
160
- - Use tbump instead of bumpversion to manage versioning and releases. (`#703 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/703>`__)
161
- - Move most of package configuration to pyproject.toml (`#704 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/704>`__)
162
- - Introduce Typed config dict (`#706 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/706>`__)
163
- - Use ankane/setup-postgres@v1 to setup postgresql in CI instead of custom scripts. (`#708 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/708>`__)
164
- - Pass codecov_token to codecov action to upload coverage. (`#721 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/721>`__)
165
- - Replaced flake8 and pydocstyle with ruff, turned on isort rules (`#735 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/735>`__)
166
- - Split single bid test job into smaller running each after another. (`#740 <https://github.com/ClearcodeHQ/pytest-postgresql/issues/740>`__)
224
+ - Drop PyPy from CI (`#669 <https://github.com/dbfixtures/pytest-postgresql/issues/669>`__)
225
+ - pytest-postgresql will now recognise and use development postgresql versions (`#691 <https://github.com/dbfixtures/pytest-postgresql/issues/691>`__)
226
+ - Use towncrier to maintain project's newsfragments/changelog (`#700 <https://github.com/dbfixtures/pytest-postgresql/issues/700>`__)
227
+ - Move project dependency management to pipenv (`#701 <https://github.com/dbfixtures/pytest-postgresql/issues/701>`__)
228
+ - Migrate to shared automerge workflow for automatic tests dependency updates (`#702 <https://github.com/dbfixtures/pytest-postgresql/issues/702>`__)
229
+ - Use tbump instead of bumpversion to manage versioning and releases. (`#703 <https://github.com/dbfixtures/pytest-postgresql/issues/703>`__)
230
+ - Move most of package configuration to pyproject.toml (`#704 <https://github.com/dbfixtures/pytest-postgresql/issues/704>`__)
231
+ - Introduce Typed config dict (`#706 <https://github.com/dbfixtures/pytest-postgresql/issues/706>`__)
232
+ - Use ankane/setup-postgres@v1 to setup postgresql in CI instead of custom scripts. (`#708 <https://github.com/dbfixtures/pytest-postgresql/issues/708>`__)
233
+ - Pass codecov_token to codecov action to upload coverage. (`#721 <https://github.com/dbfixtures/pytest-postgresql/issues/721>`__)
234
+ - Replaced flake8 and pydocstyle with ruff, turned on isort rules (`#735 <https://github.com/dbfixtures/pytest-postgresql/issues/735>`__)
235
+ - Split single bid test job into smaller running each after another. (`#740 <https://github.com/dbfixtures/pytest-postgresql/issues/740>`__)
167
236
 
168
237
 
169
238
  4.1.1
@@ -174,7 +243,7 @@ Misc
174
243
 
175
244
  - Error message typo fix
176
245
  - Docker documentation example typo fixes
177
- - Have setuptools required as package dependency. pkg_resources.parse_version is used in code
246
+ - Have setuptools required as package dependency. pkg_resources.parse_version is used in code
178
247
  but setuptools was only used as build requirements
179
248
 
180
249
  4.1.0
@@ -314,7 +383,7 @@ Bugfix
314
383
  2.6.0
315
384
  =====
316
385
 
317
- - [enhancement] add ability to pass options to pg_ctl's -o flag to send arguments to the underlying postgres executable
386
+ - [enhancement] add ability to pass options to pg_ctl's -o flag to send arguments to the underlying postgres executable
318
387
  Use `postgres_options` as fixture argument, `--postgresql-postgres-options` as pytest starting option or
319
388
  `postgresql_postgres_options` as pytest.ini configuration option
320
389
 
@@ -364,7 +433,7 @@ Bugfix
364
433
  =====
365
434
 
366
435
  - [feature] Allow to set password for postgresql. Use it throughout the flow.
367
- - [bugfix] Default Janitor's connections to postgres database. When using custom users,
436
+ - [bugfix] Default Janitor's connections to postgres database. When using custom users,
368
437
  postgres attempts to use user's database and it might not exist.
369
438
  - [bugfix] NoopExecutor connects to read version by context manager to properly handle cases
370
439
  where it can't connect to the server.
@@ -399,7 +468,7 @@ Bugfix
399
468
  1.4.1
400
469
  =====
401
470
 
402
- - [bugfix] Allow creating test database with hyphens
471
+ - [bugfix] Allow creating test database with hyphens
403
472
 
404
473
  1.4.0
405
474
  =====
@@ -19,7 +19,13 @@ Feature requests/proposals
19
19
  #. Provide as detailed description as possible
20
20
  * Use case is great to have
21
21
  #. There'll be a bit of discussion for the feature. Don't worry, if it is to be accepted, we'd like to support it, so we need to understand it thoroughly.
22
-
22
+
23
+ Development
24
+ -----------
25
+
26
+ #. Fork the repository
27
+ #. Clone the repository
28
+ #. Create a virtual environment with ``pipenv install --dev``
23
29
 
24
30
  Pull requests
25
31
  -------------
@@ -40,13 +46,17 @@ Commits
40
46
  Coding style
41
47
  ------------
42
48
 
43
- #. Coding style is being handled by black and doublechecked by flake8 and pydocstyle
49
+ #. Coding style is being handled by black and doublechecked by ruff.
44
50
  * We provide a `pre-commit <https://pre-commit.com/>`_ configuration for invoking these on commit.
45
51
 
46
52
  Testing
47
53
  -------
48
54
 
49
- # Tests are written using pytest.
50
- # PR tests run on Github Actions.
51
- # In order to run the tests locally you need to have one version of postgres installed. And pass envvar named `POSTGRES` with used version number
52
- # If you encounter any test failures due to locale issues, make sure that both `en_US.UTF-8` and `de_DE.UTF-8` are enabled in `/etc/locale.gen` and then run `sudo locale-gen`.
55
+ #. Tests are written using `pytest <https://docs.pytest.org/>`_
56
+ #. PR tests run on Github Actions.
57
+ #. Run a PostgreSQL server [#]_, and create a default super user ``createuser --superuser postgres``
58
+ #. Set envvar named ``POSTGRES`` with used version number
59
+ #. Run tests with ``pipenv run pytest``
60
+ #. If you encounter any test failures due to locale issues, make sure that both ``en_US.UTF-8`` and ``de_DE.UTF-8`` are enabled in ``/etc/locale.gen`` and then run ``sudo locale-gen``.
61
+
62
+ .. [#] Installing and configuring a PostgreSQL server is out of scope of this document. Please refer to `PostgreSQL documentation <https://www.postgresql.org/docs/>`_ for more information.
@@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
671
671
  may consider it more useful to permit linking proprietary applications with
672
672
  the library. If this is what you want to do, use the GNU Lesser General
673
673
  Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation.
162
162
  whether future versions of the GNU Lesser General Public License shall
163
163
  apply, that proxy's public statement of acceptance of any version is
164
164
  permanent authorization for you to choose that version for the
165
- Library.
165
+ Library.
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pytest-postgresql
3
- Version: 6.1.1
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
- Project-URL: Source, https://github.com/ClearcodeHQ/pytest-postgresql
7
- Project-URL: Bug Tracker, https://github.com/ClearcodeHQ/pytest-postgresql/issues
8
- Project-URL: Changelog, https://github.com/ClearcodeHQ/pytest-postgresql/blob/v6.1.1/CHANGES.rst
6
+ Project-URL: Source, https://github.com/dbfixtures/pytest-postgresql
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.1/CHANGES.rst
9
9
  Keywords: tests,pytest,fixture,postgresql
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Web Environment
@@ -15,30 +15,30 @@ Classifier: Natural Language :: English
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.8
19
18
  Classifier: Programming Language :: Python :: 3.9
20
19
  Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
22
21
  Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
23
  Classifier: Programming Language :: Python :: 3 :: Only
24
24
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
25
  Classifier: Topic :: Software Development :: Testing
26
26
  Classifier: Framework :: Pytest
27
- Requires-Python: >=3.8
27
+ Requires-Python: >=3.9
28
28
  Description-Content-Type: text/x-rst
29
29
  License-File: COPYING
30
30
  License-File: COPYING.lesser
31
31
  License-File: AUTHORS.rst
32
32
  Requires-Dist: pytest>=6.2
33
33
  Requires-Dist: port-for>=0.7.3
34
- Requires-Dist: mirakuru
35
- Requires-Dist: setuptools
34
+ Requires-Dist: mirakuru>=2.6.0
35
+ Requires-Dist: packaging
36
36
  Requires-Dist: psycopg>=3.0.0
37
37
 
38
- .. image:: https://raw.githubusercontent.com/ClearcodeHQ/pytest-postgresql/master/logo.png
38
+ .. image:: https://raw.githubusercontent.com/dbfixtures/pytest-postgresql/master/logo.png
39
39
  :width: 100px
40
40
  :height: 100px
41
-
41
+
42
42
  pytest-postgresql
43
43
  =================
44
44
 
@@ -122,38 +122,25 @@ Sample test
122
122
  postgresql.commit()
123
123
  cur.close()
124
124
 
125
- If you want the database fixture to be automatically populated with your schema there are two ways:
125
+ Pre-populating the database for tests
126
+ -------------------------------------
126
127
 
127
- #. client fixture specific
128
- #. process fixture specific
128
+ If you want the database fixture to be automatically pre-populated with your schema and data, there are two lewels you can achieve it:
129
129
 
130
- Both are accepting same set of possible loaders:
130
+ #. per test in a client fixture, by an intermediary fixture between client and your test (or other fixtures)
131
+ #. per session in a process fixture
131
132
 
132
- * sql file path
133
- * loading function import path (string)
134
- * actual loading function
133
+ The process fixture accepts a load parameter, which accepts these loaders:
135
134
 
136
- That function will receive **host**, **port**, **user**, **dbname** and **password** kwargs and will have to perform
137
- connection to the database inside. However, you'll be able to run SQL files or even trigger programmatically database
138
- migrations you have.
135
+ * sql file path - which will load and execute sql files
136
+ * loading functions - either by string import path, actual callable.
137
+ Loading functions will receive **host**, **port**, **user**, **dbname** and **password** arguments and will have to perform
138
+ connection to the database inside. Or start session in the ORM of your choice to perform actions with given ORM.
139
+ This way, you'd be able to trigger ORM based data manipulations, or even trigger database migrations programmatically.
139
140
 
140
- Client specific loads the database each test
141
-
142
- .. code-block:: python
143
-
144
- from pathlib import Path
145
- postgresql_my_with_schema = factories.postgresql(
146
- 'postgresql_my_proc',
147
- load=[Path("schemafile.sql"), Path("otherschema.sql"), "import.path.to.function", "import.path.to:otherfunction", load_this]
148
- )
149
-
150
- .. warning::
151
-
152
- This way, the database will still be dropped each time.
153
-
154
-
155
- The process fixture performs the load once per test session, and loads the data into the template database.
156
- Client fixture then creates test database out of the template database each test, which significantly **speeds up the tests**.
141
+ The process fixture pre-populates the database once per test session (at the start of the process fixture),
142
+ and loads the schema and data into the template database. Client fixture then creates test database out of the template database each test,
143
+ which significantly **speeds up the tests**.
157
144
 
158
145
  .. code-block:: python
159
146
 
@@ -162,14 +149,15 @@ Client fixture then creates test database out of the template database each test
162
149
  load=[Path("schemafile.sql"), Path("otherschema.sql"), "import.path.to.function", "import.path.to:otherfunction", load_this]
163
150
  )
164
151
 
152
+ Additional benefit, is that test code might safely use separate database connection, and can safely test it's behaviour with transactions and rollbacks,
153
+ as tests and code will work on separate database connections.
154
+
155
+ Defining pre-populate on command line:
165
156
 
166
157
  .. code-block:: sh
167
158
 
168
159
  pytest --postgresql-populate-template=path.to.loading_function --postgresql-populate-template=path.to.other:loading_function --postgresql-populate-template=path/to/file.sql
169
160
 
170
-
171
- The loading_function from example will receive , and have to commit that.
172
-
173
161
  Connecting to already existing postgresql database
174
162
  --------------------------------------------------
175
163
 
@@ -222,6 +210,12 @@ You can pick which you prefer, but remember that these settings are handled in t
222
210
  - postgresql_port
223
211
  - yes (5432)
224
212
  - random
213
+ * - Port search count
214
+ -
215
+ - --postgresql-port-search-count
216
+ - postgresql_port_search_count
217
+ - -
218
+ - 5
225
219
  * - postgresql user
226
220
  - user
227
221
  - --postgresql-user
@@ -270,6 +264,18 @@ You can pick which you prefer, but remember that these settings are handled in t
270
264
  - postgresql_options
271
265
  - yes
272
266
  -
267
+ * - Drop test database on start.
268
+
269
+ .. warning::
270
+
271
+ Use carefully as it might lead to unexpected results within your test suite.
272
+ -
273
+ - --postgresql-drop-test-database
274
+ -
275
+ - false
276
+ -
277
+
278
+
273
279
 
274
280
 
275
281
  Example usage:
@@ -385,11 +391,11 @@ For this import DatabaseJanitor and use its init and drop methods:
385
391
  # variable definition
386
392
 
387
393
  janitor = DatabaseJanitor(
388
- postgresql_proc.user,
389
- postgresql_proc.host,
390
- postgresql_proc.port,
391
- "my_test_database",
392
- postgresql_proc.version,
394
+ user=postgresql_proc.user,
395
+ host=postgresql_proc.host,
396
+ proc=postgresql_proc.port,
397
+ testdb="my_test_database",
398
+ version=postgresql_proc.version,
393
399
  password="secret_password",
394
400
  )
395
401
  janitor.init()
@@ -414,11 +420,11 @@ or use it as a context manager:
414
420
  # variable definition
415
421
 
416
422
  with DatabaseJanitor(
417
- postgresql_proc.user,
418
- postgresql_proc.host,
419
- postgresql_proc.port,
420
- "my_test_database",
421
- postgresql_proc.version,
423
+ user=postgresql_proc.user,
424
+ host=postgresql_proc.host,
425
+ port=postgresql_proc.port,
426
+ dbname="my_test_database",
427
+ version=postgresql_proc.version,
422
428
  password="secret_password",
423
429
  ):
424
430
  yield psycopg2.connect(