mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 07:18:23 +01:00
fix py2 MagicMock(sys.stderr).encoding in tests
This commit is contained in:
@@ -407,11 +407,15 @@ class TestCheckoutShouldHaveSelfClearingProgressBar(TestDvc):
|
||||
self._prepare_repo()
|
||||
|
||||
def test(self):
|
||||
encoding = sys.stderr.encoding
|
||||
with self._caplog.at_level(logging.INFO, logger="dvc"), patch.object(
|
||||
sys, "stderr"
|
||||
) as stdout_mock:
|
||||
self.stdout_mock = logger.handlers[0].stream = stdout_mock
|
||||
|
||||
if sys.version_info[:1] < (3,):
|
||||
sys.stderr.encoding = encoding
|
||||
|
||||
ret = main(["checkout"])
|
||||
self.assertEqual(0, ret)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user