From d5c33543395ad07e9581a3505c36478152f7225b Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Mon, 28 Dec 2015 14:03:52 -0500 Subject: Move prefix tests to a separate file --- tests/test_prefix.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/test_prefix.py (limited to 'tests/test_prefix.py') diff --git a/tests/test_prefix.py b/tests/test_prefix.py new file mode 100644 index 0000000..636a7d1 --- /dev/null +++ b/tests/test_prefix.py @@ -0,0 +1,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) -- cgit v1.2.3