MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_push_options

Function test_push_options

test/test_remote.py:512–539  ·  view source on GitHub ↗
(origin: Repository, clone: Repository, remote: Remote)

Source from the content-addressed store, hash-verified

510
511
512def 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
542def test_push_threads(origin: Repository, clone: Repository, remote: Remote) -> None:

Callers

nothing calls this directly

Calls 2

RemoteCallbacksClass · 0.90
pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…