-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1673 from pared/1641
add: cleanup .gitignore decorator
- Loading branch information
Showing
15 changed files
with
152 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from dvc.repo import Repo | ||
from dvc.scm import scm_context, Base | ||
from unittest import TestCase | ||
import mock | ||
|
||
|
||
class TestScmContext(TestCase): | ||
def setUp(self): | ||
self.repo_mock = mock.Mock(spec=Repo) | ||
self.scm_mock = mock.Mock(spec=Base) | ||
self.repo_mock.scm = self.scm_mock | ||
|
||
def test_should_successfully_perform_method(self): | ||
method = mock.Mock() | ||
wrapped = scm_context(method) | ||
|
||
wrapped(self.repo_mock) | ||
|
||
self.assertEqual(1, method.call_count) | ||
self.assertEqual(1, self.scm_mock.reset_ignores.call_count) | ||
self.assertEqual(1, self.scm_mock.remind_to_track.call_count) | ||
|
||
self.assertEqual(0, self.scm_mock.cleanup_ignores.call_count) | ||
|
||
def test_should_throw_and_cleanup(self): | ||
method = mock.Mock(side_effect=Exception("some problem")) | ||
wrapped = scm_context(method) | ||
|
||
with self.assertRaises(Exception): | ||
wrapped(self.repo_mock) | ||
|
||
self.assertEqual(1, method.call_count) | ||
self.assertEqual(1, self.scm_mock.cleanup_ignores.call_count) | ||
|
||
self.assertEqual(0, self.scm_mock.reset_ignores.call_count) | ||
self.assertEqual(0, self.scm_mock.remind_to_track.call_count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters