mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 01:41:57 -04:00
unit test for archive format
tests formatting with {pid} and not equal results from same
time string. (adds import time to tests)
This commit is contained in:
parent
f7c1632aee
commit
79f42571ae
1 changed files with 11 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import pytest
|
|||
import sys
|
||||
import msgpack
|
||||
import msgpack.fallback
|
||||
import time
|
||||
|
||||
from ..helpers import Location, format_file_size, format_timedelta, make_path_safe, \
|
||||
prune_within, prune_split, get_cache_dir, get_keys_dir, Statistics, is_slow_msgpack, \
|
||||
|
|
@ -101,6 +102,16 @@ class TestLocationWithoutEnv:
|
|||
assert Location(location).canonical_path() == \
|
||||
Location(Location(location).canonical_path()).canonical_path()
|
||||
|
||||
def test_format_path(self, monkeypatch):
|
||||
monkeypatch.delenv('BORG_REPO', raising=False)
|
||||
test_pid = os.getpid()
|
||||
assert repr(Location('/some/path::archive{pid}')) == \
|
||||
"Location(proto='file', user=None, host=None, port=None, path='/some/path', archive='archive{}')".format(test_pid)
|
||||
location_time1 = Location('/some/path::archive{now:%s}')
|
||||
time.sleep(1.1)
|
||||
location_time2 = Location('/some/path::archive{now:%s}')
|
||||
assert location_time1.archive != location_time2.archive
|
||||
|
||||
|
||||
class TestLocationWithEnv:
|
||||
def test_ssh(self, monkeypatch):
|
||||
|
|
|
|||
Loading…
Reference in a new issue