-
-
Notifications
You must be signed in to change notification settings - Fork 791
Open
@ThomasWaldmann
Description
master branch
netbsd9: __________________ test_basic_functionality[remote_archiver] ___________________
netbsd9: [gw7] netbsd9 -- Python 3.12.8 /vagrant/borg/borg/.tox/py312-none/bin/python
netbsd9:
netbsd9: archivers = 'remote_archiver'
netbsd9: request = <FixtureRequest for <Function test_basic_functionality[remote_archiver]>>
netbsd9:
netbsd9: def test_basic_functionality(archivers, request):
...
netbsd9: output = cmd(archiver, "diff", "test0", "test1b", "--content-only")
netbsd9: do_asserts(output, False, content_only=True)
netbsd9:
netbsd9: output = cmd(archiver, "diff", "test0", "test1a", "--json-lines")
netbsd9: > do_json_asserts(output, True)
netbsd9:
netbsd9: /vagrant/borg/borg/src/borg/testsuite/archiver/diff_cmd_test.py:257:
netbsd9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
netbsd9:
netbsd9: output = '{"changes": [{"item1": "2025-03-23T17:09:52.372257+00:00", "item2": "2025-03-23T17:10:26.935509+00:00", "type": "ctim...ed directory"}], "path": "input/dir_removed"}\n{"changes": [{"type": "removed link"}], "path": "input/link_removed"}\n'
netbsd9: can_compare_ids = True, content_only = False
netbsd9:
netbsd9: def do_json_asserts(output, can_compare_ids, content_only=False):
netbsd9: def get_changes(filename, data):
netbsd9: chgsets = [j["changes"] for j in data if j["path"] == filename]
netbsd9: assert len(chgsets) < 2
netbsd9: # return a flattened list of changes for given filename
netbsd9: return sum(chgsets, [])
netbsd9:
netbsd9: # convert output to list of dicts
netbsd9: joutput = [json.loads(line) for line in output.split("\n") if line]
netbsd9:
netbsd9: # File contents changed (deleted and replaced with a new file)
netbsd9: expected = {"type": "modified", "added": 4096, "removed": 1024} if can_compare_ids else {"type": "modified"}
netbsd9: assert expected in get_changes("input/file_replaced", joutput)
netbsd9:
netbsd9: # File unchanged
netbsd9: assert not any(get_changes("input/file_unchanged", joutput))
netbsd9:
netbsd9: # Do not show a 0 byte change for a file whose contents weren't modified.
netbsd9: unexpected = {"type": "modified", "added": 0, "removed": 0}
netbsd9: assert unexpected not in get_changes("input/file_touched", joutput)
netbsd9: if not content_only:
netbsd9: # on win32, ctime is the file creation time and does not change.
netbsd9: expected = {"mtime"} if is_win32 else {"mtime", "ctime"}
netbsd9: > assert expected.issubset({c["type"] for c in get_changes("input/file_touched", joutput)})
netbsd9: E AssertionError: assert False
netbsd9: E + where False = <built-in method issubset of set object at 0x7a19fe1603b0>({'mtime'})
netbsd9: E + where <built-in method issubset of set object at 0x7a19fe1603b0> = {'ctime', 'mtime'}.issubset
netbsd9:
netbsd9: /vagrant/borg/borg/src/borg/testsuite/archiver/diff_cmd_test.py:178: AssertionError