Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
skip unittest if graphviz could not be imported
Browse files Browse the repository at this point in the history
  • Loading branch information
roywei committed Jul 2, 2018
1 parent 0ef7c1e commit e424405
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/python/unittest/test_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import mxnet as mx
import warnings
import unittest

def test_print_summary():
data = mx.sym.Variable('data')
Expand All @@ -33,6 +34,15 @@ def test_print_summary():
shape["data"]=(1,3,28,28)
mx.viz.print_summary(sc1, shape)

def graphviz_exists():
try:
import graphviz
except ImportError:
return False
else:
return True

@unittest.skipIf(not graphviz_exists(), "Skip test_plot_network as Graphviz could not be imported")
def test_plot_network():
# Test warnings for cyclic graph
net = mx.sym.Variable('data')
Expand Down

0 comments on commit e424405

Please sign in to comment.