diff options
author | Jon Bernard <jbernard@tuxion.com> | 2015-12-28 14:03:52 -0500 |
---|---|---|
committer | Jon Bernard <jbernard@tuxion.com> | 2015-12-28 14:15:15 -0500 |
commit | d5c33543395ad07e9581a3505c36478152f7225b (patch) | |
tree | 7a68511c96aa06b12ff9a4d313fb8a92aa5c022b | |
parent | b127cace0f7a5189c800bd3f9031423ef5e5e8e0 (diff) | |
download | dotfiles-d5c33543395ad07e9581a3505c36478152f7225b.tar.gz dotfiles-d5c33543395ad07e9581a3505c36478152f7225b.tar.bz2 dotfiles-d5c33543395ad07e9581a3505c36478152f7225b.zip |
Move prefix tests to a separate file
-rw-r--r-- | tests/test_basic.py | 27 | ||||
-rw-r--r-- | tests/test_prefix.py | 41 |
2 files changed, 41 insertions, 27 deletions
diff --git a/tests/test_basic.py b/tests/test_basic.py index 1c3a77a..58e35ed 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -424,33 +424,6 @@ class DotfilesTestCase(unittest.TestCase): self.assertTrue(os.path.islink( os.path.join(self.homedir, '.config/gtk-3.0'))) - def test_package_and_prefix(self): - """Test syncing a package when using a non-default prefix.""" - - package_dir = os.path.join(self.repository, '.config/awesome') - os.makedirs(package_dir) - touch('%s/testfile' % package_dir) - - dotfiles = Dotfiles(homedir=self.homedir, - path=self.repository, - prefix='.', - ignore=[], - externals={}, - packages=['.config'], - dry_run=False, - quiet=True) - - dotfiles.sync() - - expected = os.path.join(self.homedir, ".config") - self.assertTrue(os.path.isdir(expected)) - - expected = os.path.join(expected, "awesome") - self.assertTrue(os.path.islink(expected)) - - expected = os.path.join(expected, "testfile") - self.assertTrue(os.path.isfile(expected)) - if __name__ == '__main__': unittest.main() 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) |