pytest-neon 2.1.1__tar.gz → 2.1.3__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.
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/CLAUDE.md +1 -7
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/PKG-INFO +1 -1
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/pyproject.toml +1 -1
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/src/pytest_neon/__init__.py +1 -1
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/src/pytest_neon/plugin.py +12 -4
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_reset_behavior.py +37 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/uv.lock +1 -1
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/.env.example +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/.github/workflows/release.yml +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/.github/workflows/tests.yml +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/.gitignore +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/.neon +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/LICENSE +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/README.md +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/src/pytest_neon/py.typed +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/conftest.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_branch_lifecycle.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_cli_options.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_env_var.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_fixture_errors.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_integration.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_migrations.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_readwrite_readonly_fixtures.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_skip_behavior.py +0 -0
- {pytest_neon-2.1.1 → pytest_neon-2.1.3}/tests/test_xdist_worker_support.py +0 -0
|
@@ -81,15 +81,9 @@ Tests in `tests/` use `pytester` for testing pytest plugins. The plugin itself c
|
|
|
81
81
|
|
|
82
82
|
## Publishing
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
**Always use the GitHub Actions release workflow** - do not manually bump versions:
|
|
85
85
|
1. Go to Actions → Release → Run workflow
|
|
86
86
|
2. Choose patch/minor/major
|
|
87
87
|
3. Workflow bumps version, commits, tags, and publishes to PyPI
|
|
88
88
|
|
|
89
|
-
Or manually:
|
|
90
|
-
```bash
|
|
91
|
-
uv build
|
|
92
|
-
uv publish --token $PYPI_TOKEN
|
|
93
|
-
```
|
|
94
|
-
|
|
95
89
|
Package name on PyPI: `pytest-neon`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-neon
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.3
|
|
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
|
|
@@ -480,9 +480,17 @@ def _wait_for_operations(
|
|
|
480
480
|
return # All operations already complete
|
|
481
481
|
|
|
482
482
|
waited = 0.0
|
|
483
|
+
first_poll = True
|
|
483
484
|
while pending_op_ids and waited < max_wait_seconds:
|
|
484
|
-
time
|
|
485
|
-
|
|
485
|
+
# Poll immediately first time (operation usually completes instantly),
|
|
486
|
+
# then wait between subsequent polls
|
|
487
|
+
if first_poll:
|
|
488
|
+
time.sleep(0.1) # Tiny delay to let operation start
|
|
489
|
+
waited += 0.1
|
|
490
|
+
first_poll = False
|
|
491
|
+
else:
|
|
492
|
+
time.sleep(poll_interval)
|
|
493
|
+
waited += poll_interval
|
|
486
494
|
|
|
487
495
|
# Check status of each pending operation
|
|
488
496
|
still_pending = []
|
|
@@ -494,10 +502,10 @@ def _wait_for_operations(
|
|
|
494
502
|
op_data = response.json().get("operation", {})
|
|
495
503
|
status = op_data.get("status")
|
|
496
504
|
|
|
497
|
-
if status == "
|
|
505
|
+
if status == "failed":
|
|
498
506
|
err = op_data.get("error", "unknown error")
|
|
499
507
|
raise RuntimeError(f"Operation {op_id} failed: {err}")
|
|
500
|
-
if status not in ("finished", "skipped"):
|
|
508
|
+
if status not in ("finished", "skipped", "cancelled"):
|
|
501
509
|
still_pending.append(op_id)
|
|
502
510
|
except requests.RequestException:
|
|
503
511
|
# On network error, assume still pending and retry
|
|
@@ -162,6 +162,43 @@ class TestResetRetryBehavior:
|
|
|
162
162
|
# Should have polled until finished
|
|
163
163
|
assert get_call_count[0] == 3
|
|
164
164
|
|
|
165
|
+
def test_reset_raises_on_failed_operation(self, mocker):
|
|
166
|
+
"""Verify reset raises RuntimeError when operation fails."""
|
|
167
|
+
branch = NeonBranch(
|
|
168
|
+
branch_id="br-test",
|
|
169
|
+
project_id="proj-test",
|
|
170
|
+
connection_string="postgresql://test",
|
|
171
|
+
host="test.neon.tech",
|
|
172
|
+
parent_id="br-parent",
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# Mock POST response with pending operation
|
|
176
|
+
mock_post_response = mocker.Mock()
|
|
177
|
+
mock_post_response.raise_for_status = mocker.Mock()
|
|
178
|
+
mock_post_response.json.return_value = {
|
|
179
|
+
"operations": [{"id": "op-123", "status": "running"}]
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
# Mock GET response: operation failed
|
|
183
|
+
mock_get_response = mocker.Mock()
|
|
184
|
+
mock_get_response.raise_for_status = mocker.Mock()
|
|
185
|
+
mock_get_response.json.return_value = {
|
|
186
|
+
"operation": {
|
|
187
|
+
"id": "op-123",
|
|
188
|
+
"status": "failed",
|
|
189
|
+
"error": "Something went wrong",
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
mocker.patch(
|
|
194
|
+
"pytest_neon.plugin.requests.post", return_value=mock_post_response
|
|
195
|
+
)
|
|
196
|
+
mocker.patch("pytest_neon.plugin.requests.get", return_value=mock_get_response)
|
|
197
|
+
mocker.patch("pytest_neon.plugin.time.sleep")
|
|
198
|
+
|
|
199
|
+
with pytest.raises(RuntimeError, match="Operation op-123 failed"):
|
|
200
|
+
_reset_branch_to_parent(branch, "fake-api-key")
|
|
201
|
+
|
|
165
202
|
|
|
166
203
|
class TestResetBehavior:
|
|
167
204
|
"""Test that branch reset happens between tests."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|