-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest_svn.py
More file actions
70 lines (49 loc) · 1.74 KB
/
test_svn.py
File metadata and controls
70 lines (49 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""Tests for libvcs svn repos."""
import pathlib
import shutil
import pytest
from libvcs.pytest_plugin import CreateRepoPytestFixtureFn
from libvcs.sync.svn import SvnSync
if not shutil.which("svn"):
pytestmark = pytest.mark.skip(reason="svn is not available")
def test_svn_sync(tmp_path: pathlib.Path, svn_remote_repo: pathlib.Path) -> None:
"""Tests for SvnSync."""
repo_name = "my_svn_project"
svn_repo = SvnSync(
url=f"file://{svn_remote_repo}",
path=str(tmp_path / repo_name),
)
svn_repo.obtain()
svn_repo.update_repo()
assert svn_repo.get_revision() == 0
assert svn_repo.get_revision_file("./") == 0
assert (tmp_path / repo_name).exists()
def test_svn_sync_with_files(
tmp_path: pathlib.Path,
svn_remote_repo_with_files: pathlib.Path,
) -> None:
"""Tests for SvnSync."""
repo_name = "my_svn_project"
svn_repo = SvnSync(
url=f"file://{svn_remote_repo_with_files}",
path=str(tmp_path / repo_name),
)
svn_repo.obtain()
svn_repo.update_repo()
assert svn_repo.get_revision() == 0
assert svn_repo.get_revision_file("./") == 3
assert (tmp_path / repo_name).exists()
def test_repo_svn_remote_checkout(
create_svn_remote_repo: CreateRepoPytestFixtureFn,
tmp_path: pathlib.Path,
projects_path: pathlib.Path,
) -> None:
"""Tests for SvnSync with remote checkout."""
svn_server = create_svn_remote_repo()
svn_repo_checkout_dir = projects_path / "my_svn_checkout"
svn_repo = SvnSync(path=svn_repo_checkout_dir, url=f"file://{svn_server!s}")
svn_repo.obtain()
svn_repo.update_repo()
assert svn_repo.get_revision() == 0
assert svn_repo.get_revision_file("./") == 0
assert svn_repo_checkout_dir.exists()