Page MenuHomeSoftware Heritage

svn: Add missing coverage on svn implementation
Closed, ResolvedPublic

Description

It appears SvnLoaderFromDumpArchive is missing actual tests (without mock).
That needs fixing.

As some recent tryout to try and instantiate revealed difficult.
That serves both the purpose to avoid:

  • code rot
  • document usage

That does not exclude the fact that the loader needs a better documentation as well.

Event Timeline

ardumont triaged this task as Normal priority.Oct 22 2021, 12:11 PM
ardumont created this task.

fwiw

import os

from swh.storage import get_storage
from swh.loader.svn.loader import SvnLoaderFromRemoteDump
from swh.loader.svn.utils import init_svn_repo_from_dump

storage = get_storage(cls='memory')

archive_dump = '/tmp/0001-bee-repo.svndump.gz'

temp_dir, repo_path = init_svn_repo_from_dump(
    archive_dump, gzip=True
)
repo_url = f"file://{repo_path}"

loader = SvnLoaderFromRemoteDump(
    storage, repo_url
)
assert loader.load() == {"status": "eventful"}

does the job