Skip to content

Commit

Permalink
metrics: don't forget to checkout()
Browse files Browse the repository at this point in the history
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
  • Loading branch information
efiop committed Apr 20, 2018
1 parent 9bd8354 commit 5985fd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dvc/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,13 @@ def metrics(self, path, json_path=None, tsv_path=None, htsv_path=None):
saved = self.scm.active_branch()
for branch in self.scm.list_branches():
self.scm.checkout(branch)
self.checkout()
res[branch] = self._read_metric(path,
json_path=json_path,
tsv_path=tsv_path,
htsv_path=htsv_path)
self.scm.checkout(saved)
self.checkout()
return res

def graph(self):
Expand Down
10 changes: 8 additions & 2 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dvc.main import main
from tests.basic_env import TestDvc


class TestMetrics(TestDvc):
def setUp(self):
super(TestMetrics, self).setUp()
Expand Down Expand Up @@ -57,9 +58,14 @@ def test(self):
self.assertTrue(ret['bar'] == ['bar'])
self.assertTrue(ret['baz'] == ['baz'])

def test_cli(self):

class TestMetricsCLI(TestMetrics):
def test(self):
#FIXME enable on windows
if os.name == 'nt':
return
#FIXME check output
ret = main(['metrics', 'metric'])
ret = main(['metrics', 'metric', '-v'])
self.assertEqual(ret, 0)

ret = main(['metrics', 'metric_json', '--json-path', 'branch'])
Expand Down

0 comments on commit 5985fd3

Please sign in to comment.