aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-04 07:29:25 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-04 07:34:44 -0500
commit4b9b21b40f911e11dba5de9893d434f010f54c12 (patch)
tree1698d6249841c16a2f6503556b1d1049cb27e9fe
parentfc157276c39a1e46c95f07e11dbe0014374d1a15 (diff)
downloaddotfiles-4b9b21b40f911e11dba5de9893d434f010f54c12.tar.gz
dotfiles-4b9b21b40f911e11dba5de9893d434f010f54c12.tar.bz2
dotfiles-4b9b21b40f911e11dba5de9893d434f010f54c12.zip
Remove unique_suffix function, not needed
-rw-r--r--dotfiles.py8
-rw-r--r--test_dotfiles.py18
2 files changed, 2 insertions, 24 deletions
diff --git a/dotfiles.py b/dotfiles.py
index e49a69b..18d49aa 100644
--- a/dotfiles.py
+++ b/dotfiles.py
@@ -9,11 +9,6 @@ DEFAULT_HOME = os.path.expanduser('~/')
DEFAULT_REPO = os.path.expanduser('~/Dotfiles')
-def unique_suffix(path_a, path_b):
- discard = len(str(path_a.common(path_b))) + 1
- return (str(path_a)[discard:], str(path_b)[discard:])
-
-
class Repository(object):
"""A repository is a directory that contains dotfiles.
@@ -58,8 +53,7 @@ class Dotfile(object):
self.target = target
def __str__(self):
- short_name, _ = unique_suffix(self.name, self.target)
- return '%s' % short_name
+ return self.name.basename
def __repr__(self):
return '<Dotfile %r>' % self.name
diff --git a/test_dotfiles.py b/test_dotfiles.py
index db63632..ed67884 100644
--- a/test_dotfiles.py
+++ b/test_dotfiles.py
@@ -1,23 +1,7 @@
import py
import pytest
-from dotfiles import cli, unique_suffix
-from dotfiles import Repository, Dotfile
-
-
-def test_unique_suffix_overlap():
- (name, target) = unique_suffix(py.path.local('/foo/baz'),
- py.path.local('/foo/bar/bat'))
- assert name == 'baz'
- assert target == 'bar/bat'
-
-
-@pytest.mark.xfail(reason='this is a bug')
-def test_unique_suffix_no_overlap():
- (name, target) = unique_suffix(py.path.local('/a/b/c'),
- py.path.local('/d/e/f'))
- assert name == '/a/b/c'
- assert target == '/d/e/f'
+from dotfiles import Repository, Dotfile, cli
class TestCli(object):