File tree Expand file tree Collapse file tree 2 files changed +23
-17
lines changed
Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,8 @@ def _show_dot(G):
2323
2424 from networkx .drawing .nx_pydot import write_dot
2525
26- G = G .reverse ()
2726 dot_file = io .StringIO ()
28- write_dot (G , dot_file )
27+ write_dot (G . reverse () , dot_file )
2928 return dot_file .getvalue ()
3029
3130
Original file line number Diff line number Diff line change @@ -135,22 +135,29 @@ def test_show_ascii(repo):
135135
136136
137137def test_show_dot (repo ):
138- assert _show_dot (repo .index .graph ) == (
139- "strict digraph {\n "
140- "stage;\n "
141- "stage;\n "
142- "stage;\n "
143- "stage;\n "
144- "stage;\n "
145- "stage;\n "
146- "\" stage: 'b.dvc'\" -> \" stage: '2'\" ;\n "
147- "\" stage: 'b.dvc'\" -> \" stage: '3'\" ;\n "
148- "\" stage: 'a.dvc'\" -> \" stage: '1'\" ;\n "
149- "\" stage: 'a.dvc'\" -> \" stage: '3'\" ;\n "
150- "\" stage: 'a.dvc'\" -> \" stage: '4'\" ;\n "
151- "\" stage: '3'\" -> \" stage: '4'\" ;\n "
152- "}\n "
138+ # dot file rendering is not deterministic though graph
139+ # output doesn't depend upon order of lines. Use sorted values
140+ # https://github.com/iterative/dvc/pull/7725
141+ expected = [
142+ "\" stage: '3'\" -> \" stage: '4'\" ;" ,
143+ "\" stage: 'a.dvc'\" -> \" stage: '1'\" ;" ,
144+ "\" stage: 'a.dvc'\" -> \" stage: '3'\" ;" ,
145+ "\" stage: 'a.dvc'\" -> \" stage: '4'\" ;" ,
146+ "\" stage: 'b.dvc'\" -> \" stage: '2'\" ;" ,
147+ "\" stage: 'b.dvc'\" -> \" stage: '3'\" ;" ,
148+ "stage;" ,
149+ "stage;" ,
150+ "stage;" ,
151+ "stage;" ,
152+ "stage;" ,
153+ "stage;" ,
154+ "strict digraph {" ,
155+ "}" ,
156+ ]
157+ actual = sorted (
158+ line .rstrip () for line in _show_dot (repo .index .graph ).splitlines ()
153159 )
160+ assert actual == expected
154161
155162
156163def test_show_mermaid (repo ):
You can’t perform that action at this time.
0 commit comments