aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_prefix.py
blob: 636a7d196ff10720880228230442ed1071c4f3d9 (plain) (blame)
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
import pytest
from dotfiles.core import Dotfiles


@pytest.mark.xfail()
def test_prefix(tmpdir):
    """Test basic sync when using a non-default prefix."""

    dotfile = tmpdir.ensure('Dotfiles/_vimrc')
    symlink = tmpdir.join('.vimrc')

    Dotfiles(homedir=str(tmpdir),
             path=str(dotfile.dirname),
             prefix='_',
             ignore=[],
             externals={},
             packages=[],
             dry_run=False).sync()

    assert symlink.check(link=1)
    assert symlink.samefile(dotfile)


def test_prefix_with_package(tmpdir):
    """Test syncing a package when using a non-default prefix."""

    repository = tmpdir.ensure('Dotfiles', dir=1)
    dotfile = repository.ensure('.config/awesome/testfile')

    Dotfiles(homedir=str(tmpdir),
             path=str(repository),
             prefix='.',
             ignore=[],
             externals={},
             packages=['.config'],
             dry_run=False,
             quiet=True).sync()

    assert tmpdir.join('.config').check(dir=1)
    assert tmpdir.join('.config/awesome').check(link=1)
    assert tmpdir.join('.config/awesome').samefile(dotfile.dirname)