tests: fix get_gitignore_content

readlines() returns entries with \n on the end
This commit is contained in:
Andrew Grigorev
2019-03-21 19:47:42 +03:00
parent 2ef3a7c7c0
commit 63dd3f2c25
3 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -475,7 +475,7 @@ class TestShouldCleanUpAfterFailedAdd(TestDvc):
self.assertFalse(os.path.exists(bar_stage_file))
gitignore_content = get_gitignore_content()
self.assertFalse(any(self.BAR in line for line in gitignore_content))
self.assertNotIn("/" + self.BAR, gitignore_content)
class TestShouldNotTrackGitInternalFiles(TestDvc):
+1 -2
View File
@@ -64,8 +64,7 @@ class TestSCMGitSubmodule(TestGitSubmodule):
class TestIgnore(TestGit):
def _count_gitignore(self):
lines = get_gitignore_content()
return len(list(filter(lambda x: x.strip() == "/" + self.FOO, lines)))
return len([i for i in lines if i == "/" + self.FOO])
def test_ignore(self):
git = Git(self._root_dir)
+1 -1
View File
@@ -20,7 +20,7 @@ def spy(method_to_decorate):
def get_gitignore_content():
with open(Git.GITIGNORE, "r") as gitignore:
return gitignore.readlines()
return gitignore.read().splitlines()
def load_stage_file(path):