Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/python/mozversioncontrol/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  test_try_commit.py   Sprache: Python

 
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this,
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import mozunit
import pytest

from mozversioncontrol import get_repository_object


@pytest.mark.xfail(reason="Requires the Mercurial evolve extension.", strict=False)
def test_try_commit(repo):
    commit_message = "try commit message"
    vcs = get_repository_object(repo.dir)
    initial_head_ref = vcs.head_ref

    # Create a non-empty commit.
    with vcs.try_commit(commit_message, {"try_task_config.json""{}"}) as head:
        assert vcs.get_changed_files(rev=head) == ["try_task_config.json"]

    assert (
        vcs.head_ref == initial_head_ref
    ), "We should have reverted to previous head after try_commit"

    # Create an empty commit.
    with vcs.try_commit(commit_message) as head:
        assert vcs.get_changed_files(rev=head) == []

    assert (
        vcs.head_ref == initial_head_ref
    ), "We should have reverted to previous head after try_commit"


if __name__ == "__main__":
    mozunit.main()

100%


¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.