pytest-neon 2.3.0__tar.gz → 2.3.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 (30) hide show
  1. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/PKG-INFO +1 -1
  2. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/pyproject.toml +1 -1
  3. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/src/pytest_neon/__init__.py +1 -1
  4. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/src/pytest_neon/plugin.py +24 -13
  5. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/uv.lock +1 -1
  6. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/.config/wt.toml +0 -0
  7. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/.env.example +0 -0
  8. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/.github/workflows/release.yml +0 -0
  9. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/.github/workflows/tests.yml +0 -0
  10. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/.gitignore +0 -0
  11. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/.neon +0 -0
  12. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/CLAUDE.md +0 -0
  13. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/LICENSE +0 -0
  14. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/README.md +0 -0
  15. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/src/pytest_neon/py.typed +0 -0
  16. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/conftest.py +0 -0
  17. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_branch_lifecycle.py +0 -0
  18. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_branch_name_prefix.py +0 -0
  19. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_cli_options.py +0 -0
  20. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_default_branch_safety.py +0 -0
  21. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_dirty_isolated_fixtures.py +0 -0
  22. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_env_var.py +0 -0
  23. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_fixture_errors.py +0 -0
  24. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_integration.py +0 -0
  25. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_migrations.py +0 -0
  26. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_readwrite_readonly_fixtures.py +0 -0
  27. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_reset_behavior.py +0 -0
  28. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_service_classes.py +0 -0
  29. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_skip_behavior.py +0 -0
  30. {pytest_neon-2.3.0 → pytest_neon-2.3.1}/tests/test_xdist_worker_support.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-neon
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Pytest plugin for Neon database branch isolation in tests
5
5
  Project-URL: Homepage, https://github.com/ZainRizvi/pytest-neon
6
6
  Project-URL: Repository, https://github.com/ZainRizvi/pytest-neon
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pytest-neon"
7
- version = "2.3.0"
7
+ version = "2.3.1"
8
8
  description = "Pytest plugin for Neon database branch isolation in tests"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -9,7 +9,7 @@ from pytest_neon.plugin import (
9
9
  neon_engine,
10
10
  )
11
11
 
12
- __version__ = "2.3.0"
12
+ __version__ = "2.3.1"
13
13
  __all__ = [
14
14
  "NeonBranch",
15
15
  "neon_branch",
@@ -295,6 +295,17 @@ def _get_git_branch_name() -> str | None:
295
295
  return None
296
296
 
297
297
 
298
+ def _extract_password_from_connection_string(connection_string: str) -> str:
299
+ """Extract password from a PostgreSQL connection string."""
300
+ # Format: postgresql://user:password@host/db?params
301
+ from urllib.parse import urlparse
302
+
303
+ parsed = urlparse(connection_string)
304
+ if parsed.password:
305
+ return parsed.password
306
+ raise ValueError(f"No password found in connection string: {connection_string}")
307
+
308
+
298
309
  def _get_schema_fingerprint(connection_string: str) -> tuple[tuple[Any, ...], ...]:
299
310
  """
300
311
  Get a fingerprint of the database schema for change detection.
@@ -537,9 +548,15 @@ class NeonBranchManager:
537
548
  endpoint_id = result.endpoint.id
538
549
  host = self._wait_for_endpoint(endpoint_id)
539
550
 
540
- # Get password for the read_only endpoint
541
- connection_string = self._reset_password_and_build_connection_string(
542
- branch.branch_id, host
551
+ # Reuse the password from the parent branch's connection string.
552
+ # DO NOT call role_password_reset here - it would invalidate the
553
+ # password used by the parent branch's read_write endpoint, breaking
554
+ # any existing connections (especially in xdist where other workers
555
+ # may be using the cached connection string).
556
+ password = _extract_password_from_connection_string(branch.connection_string)
557
+ connection_string = (
558
+ f"postgresql://{self.config.role_name}:{password}@{host}/"
559
+ f"{self.config.database_name}?sslmode=require"
543
560
  )
544
561
 
545
562
  return NeonBranch(
@@ -1170,16 +1187,10 @@ def _create_readonly_endpoint(
1170
1187
 
1171
1188
  host = endpoint.host
1172
1189
 
1173
- # Reset password to get the password value for this endpoint
1174
- password_response = _retry_on_rate_limit(
1175
- lambda: neon.role_password_reset(
1176
- project_id=branch.project_id,
1177
- branch_id=branch.branch_id,
1178
- role_name=role_name,
1179
- ),
1180
- operation_name="role_password_reset_readonly",
1181
- )
1182
- password = password_response.role.password
1190
+ # Reuse the password from the parent branch's connection string.
1191
+ # DO NOT call role_password_reset here - it would invalidate the
1192
+ # password used by the parent branch's read_write endpoint.
1193
+ password = _extract_password_from_connection_string(branch.connection_string)
1183
1194
 
1184
1195
  # Build connection string for the read_only endpoint
1185
1196
  connection_string = (
@@ -1212,7 +1212,7 @@ wheels = [
1212
1212
 
1213
1213
  [[package]]
1214
1214
  name = "pytest-neon"
1215
- version = "2.3.0"
1215
+ version = "2.3.1"
1216
1216
  source = { editable = "." }
1217
1217
  dependencies = [
1218
1218
  { name = "filelock", version = "3.19.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes