tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit ff4ddea5465b55c9db84c9462055ebd6d12c6d21
parent 8fa452d6e3f7d238ed8f99dfc024a65bee9870ca
Author: Steve Fink <sfink@mozilla.com>
Date:   Fri,  7 Nov 2025 18:32:59 +0000

Bug 1996371 - Fix various `jj` test issues r=sfink,ErichDonGubler

Differential Revision: https://phabricator.services.mozilla.com/D270073

Diffstat:
Mpython/mozversioncontrol/test/conftest.py | 7++++++-
Mpython/mozversioncontrol/test/test_context_manager.py | 5++++-
Mpython/mozversioncontrol/test/test_diff_stream.py | 4++--
Mpython/mozversioncontrol/test/test_get_commits.py | 4++--
4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/python/mozversioncontrol/test/conftest.py b/python/mozversioncontrol/test/conftest.py @@ -58,6 +58,7 @@ SETUP = { jj config set --repo user.name "Testing McTesterson" jj config set --repo user.email "test@example.org" jj describe --reset-author --no-edit + jj abandon """, """ jj git remote add upstream ../remoterepo @@ -98,7 +99,7 @@ def shell(cmd, working_dir): @pytest.fixture(params=["git", "hg", "jj", "src"]) def repo(request): if request.param == "jj": - if os.getenv("MOZ_AUTOMATION") == 1: + if os.getenv("MOZ_AUTOMATION") == "1": fetches_dir = os.environ.get("MOZ_FETCHES_DIR", "") jj_dir = Path(fetches_dir) / "jj" if jj_dir.is_dir(): @@ -113,6 +114,10 @@ def repo(request): subprocess.call(["jj", "--version"], stdout=subprocess.DEVNULL) except OSError: pytest.skip("jj unavailable") + + # Isolate jj tests from user's local config + os.environ["JJ_CONFIG"] = "" + vcs = request.param # Use tempfile since pytest's tempdir is too long for jj on Windows td = tempfile.TemporaryDirectory(prefix=f"{vcs}-repo") diff --git a/python/mozversioncontrol/test/test_context_manager.py b/python/mozversioncontrol/test/test_context_manager.py @@ -11,7 +11,10 @@ def test_context_manager(repo): cmd = { "git": ["show", "--no-patch"], "hg": ["tip"], - "jj": ["show", "@-"], + # For jj, remove most of the header to avoid relative timestamps (one + # output might say "(now)", the next "(1 second ago)" for the same + # timestamp.) + "jj": ["show", "@-", "--template", "description ++ '\\n'"], "src": ["echo", "src"], }[repo.vcs] diff --git a/python/mozversioncontrol/test/test_diff_stream.py b/python/mozversioncontrol/test/test_diff_stream.py @@ -70,11 +70,11 @@ STEPS = { """ echo foo > file1.txt jj desc -m "FIRST PATCH" - jj new 'description("BASE PATCH")' + jj new "description('BASE PATCH')" echo notfoo > file1.txt echo bar > anotherfile.txt jj desc -m "OTHER PATCH" - jj new 'description("FIRST PATCH")' @ -m "SECOND PATCH" + jj new "description('FIRST PATCH')" @ -m "SECOND PATCH" jj new -m "resolve conflict" echo merged > file1.txt """, diff --git a/python/mozversioncontrol/test/test_get_commits.py b/python/mozversioncontrol/test/test_get_commits.py @@ -29,10 +29,10 @@ STEPS = { "jj": [ # snapshot, since mach's jj integration avoids doing this automatically """ - jj new -m "commit 1" echo bar >> bar - jj commit -m "commit 2" + jj commit -m "commit 1" echo baz > baz + jj commit -m "commit 2" jj log -n0 """ ],