• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thht / plus_sync / 212

04 May 2026 07:00AM UTC coverage: 64.842% (-27.2%) from 92.008%
212

Pull #32

gitlab-ci

update deps
Pull Request #32: update deps

616 of 950 relevant lines covered (64.84%)

0.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.94
/src/plus_sync/pytest/plugin.py
1
import shutil
×
2
import subprocess
×
3
import tempfile
×
4
from collections.abc import Generator
×
5
from functools import partial
×
6
from pathlib import Path
×
7
from typing import Callable
×
8

9
import pytest
×
10
from typer.testing import CliRunner
×
11

12
import plus_sync.cmd as ps_command
×
13
from plus_sync.pytest.factories.subject_file import SubjectFile, SubjectFileFactory
×
14

15
runner = CliRunner()
×
16

17

18
@pytest.fixture()
×
19
def plus_sync_to_temp_folder(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> Generator[Path]:
×
20
    monkeypatch.chdir(tmp_path)
1✔
21
    yield tmp_path
1✔
22

23

24
@pytest.fixture(scope='function')
×
25
def plus_sync_cmd(plus_sync_to_temp_folder: Path) -> Callable:
×
26
    return partial(runner.invoke, ps_command.app)
1✔
27

28

29
@pytest.fixture(scope='function')
×
30
def plus_sync_initialized(plus_sync_cmd: Callable) -> Generator[Callable]:
×
31
    # remove config file if it exists
32
    Path('plus_sync.toml').unlink(missing_ok=True)
1✔
33
    # remove data folder recursively if it exists
34
    if Path('data_synced').exists():
1✔
35
        shutil.rmtree('data_synced')
×
36
    result = plus_sync_cmd(['init'], input='test\n')
1✔
37
    assert result.exit_code == 0
1✔
38
    assert 'Done' in result.stdout
1✔
39
    yield plus_sync_cmd
1✔
40

41

42
@pytest.fixture(scope='function')
×
43
def plus_sync_subjects_in_folder() -> Generator[Callable]:
×
44
    with tempfile.TemporaryDirectory() as tmpdir:
1✔
45

46
        def _subjects_in_folder(n_subjects: int, path: Path, lowercase: bool = True) -> tuple[list[SubjectFile], Path]:
1✔
47
            tmpdir_path = Path(tmpdir)
1✔
48
            subjects = SubjectFileFactory.create_batch(n_subjects, path=path, lowercase=lowercase)
1✔
49
            for subject in subjects:
1✔
50
                subject.save_to_disk(tmpdir_path)
1✔
51

52
            return subjects, tmpdir_path
1✔
53

54
        yield _subjects_in_folder
1✔
55

56

57
@pytest.fixture(scope='function')
×
58
def rclone_config(monkeypatch: pytest.MonkeyPatch) -> Generator[str]:
×
59
    rclone_config_remote_name = 'test'
1✔
60
    monkeypatch.setenv('RCLONE_CONFIG', 'rclone.conf')
1✔
61
    rclone('config', 'create', rclone_config_remote_name, 'local')
1✔
62
    yield rclone_config_remote_name
1✔
63
    Path('rclone.conf').unlink(missing_ok=True)
1✔
64

65

66
def rclone(*args: str) -> subprocess.CompletedProcess:
×
67
    return subprocess.run(['rclone', '--config', 'rclone.conf', *args], capture_output=True, check=False)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc