(origin: Repository, clone: Repository, remote: Remote)
| 510 | |
| 511 | |
| 512 | def test_push_options(origin: Repository, clone: Repository, remote: Remote) -> None: |
| 513 | from pygit2 import RemoteCallbacks |
| 514 | |
| 515 | callbacks = RemoteCallbacks() |
| 516 | remote.push(['refs/heads/master'], callbacks) |
| 517 | remote_push_options = callbacks.push_options.remote_push_options |
| 518 | assert remote_push_options.count == 0 |
| 519 | |
| 520 | callbacks = RemoteCallbacks() |
| 521 | remote.push(['refs/heads/master'], callbacks, push_options=[]) |
| 522 | remote_push_options = callbacks.push_options.remote_push_options |
| 523 | assert remote_push_options.count == 0 |
| 524 | |
| 525 | callbacks = RemoteCallbacks() |
| 526 | # Local remotes don't support push_options, so pushing will raise an error. |
| 527 | # However, push_options should still be set in RemoteCallbacks. |
| 528 | with pytest.raises(pygit2.GitError, match='push-options not supported by remote'): |
| 529 | remote.push(['refs/heads/master'], callbacks, push_options=['foo']) |
| 530 | remote_push_options = callbacks.push_options.remote_push_options |
| 531 | assert remote_push_options.count == 1 |
| 532 | # strings pointed to by remote_push_options.strings[] are already freed |
| 533 | |
| 534 | callbacks = RemoteCallbacks() |
| 535 | with pytest.raises(pygit2.GitError, match='push-options not supported by remote'): |
| 536 | remote.push(['refs/heads/master'], callbacks, push_options=['Opt A', 'Opt B']) |
| 537 | remote_push_options = callbacks.push_options.remote_push_options |
| 538 | assert remote_push_options.count == 2 |
| 539 | # strings pointed to by remote_push_options.strings[] are already freed |
| 540 | |
| 541 | |
| 542 | def test_push_threads(origin: Repository, clone: Repository, remote: Remote) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…