mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
tests: fix get_gitignore_content
readlines() returns entries with \n on the end
This commit is contained in:
+1
-1
@@ -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
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user