Fix tests by ignoring metadata
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
(we skip applying it because no permissions)
This commit is contained in:
parent
6bb4b87a9a
commit
926fcdbdb9
|
@ -1,5 +1,4 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from random import Random
|
from random import Random
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
|
@ -57,4 +56,6 @@ class TestBackupAndExtract(TestCase):
|
||||||
key, value = next(iter(value.contents.items()))
|
key, value = next(iter(value.contents.items()))
|
||||||
self.assertEqual(key, "srca")
|
self.assertEqual(key, "srca")
|
||||||
|
|
||||||
self.assertEqual(value, later_expected_descriptor)
|
self.assertEqual(
|
||||||
|
value.ignore_metadata(), later_expected_descriptor.ignore_metadata()
|
||||||
|
)
|
||||||
|
|
|
@ -26,6 +26,11 @@ class FileDescriptor:
|
||||||
owner: int
|
owner: int
|
||||||
group: int
|
group: int
|
||||||
|
|
||||||
|
def ignore_metadata(self) -> "FileDescriptor":
|
||||||
|
return FileDescriptor(
|
||||||
|
sha256_sum=self.sha256_sum, mtime_ms=0, permissions=0, owner=0, group=0
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@attr.s(auto_attribs=True, frozen=True)
|
@attr.s(auto_attribs=True, frozen=True)
|
||||||
class DirectoryDescriptor:
|
class DirectoryDescriptor:
|
||||||
|
@ -35,6 +40,15 @@ class DirectoryDescriptor:
|
||||||
owner: int
|
owner: int
|
||||||
group: int
|
group: int
|
||||||
|
|
||||||
|
def ignore_metadata(self) -> "DirectoryDescriptor":
|
||||||
|
return DirectoryDescriptor(
|
||||||
|
immutabledict({k: v.ignore_metadata() for k, v in self.contents.items()}),
|
||||||
|
mtime_ms=0,
|
||||||
|
permissions=0,
|
||||||
|
owner=0,
|
||||||
|
group=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def generate_random_file(rng: Random, path: Path) -> FileDescriptor:
|
def generate_random_file(rng: Random, path: Path) -> FileDescriptor:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue