some more work on testsuite before bed
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Olivier 'reivilibre' 2021-07-18 22:15:24 +01:00
parent ccb021fb70
commit 761c4f6467
2 changed files with 24 additions and 1 deletions

View File

@ -23,6 +23,7 @@ class FileDescriptor:
owner: int
group: int
@attr.s(auto_attribs=True, frozen=True)
class DirectoryDescriptor:
contents: immutabledict[str, Union[FileDescriptor, "DirectoryDescriptor"]]
@ -126,7 +127,8 @@ def scan_file(path: Path) -> FileDescriptor:
def scan_dir(path: Path) -> DirectoryDescriptor:
contents = dict()
for name in os.scandir(path):
for entry in os.scandir(path):
name = entry.name
if name in ('.', '..'):
continue
filepath = path.joinpath(name)

View File

@ -0,0 +1,21 @@
import subprocess
from pathlib import Path
def get_hostname():
return subprocess.check_output("hostname").strip()
def set_up_simple_datman(path: Path):
subprocess.check_call(("datman", "init"), cwd=path)
with path.joinpath("").open("a") as file:
file.write(f"""
[source.srca]
directory = "{path.joinpath("srca")}"
hostname = "{get_hostname()}"
[piles.main]
path = "main"
included_labels = ["precious"]
""")