37 from mock
import Mock, patch
48 with patch(
'rospkg.RosPack')
as rospack:
49 with patch(
'rospkg.RosStack')
as rosstack:
52 rospack.list.return_value = []
53 rosstack.list.return_value = []
54 factoryMock.get_graph.return_value = graphMock
56 graph = gen.generate_dotcode(factoryMock)
58 rospack.list.assert_any_call()
59 rosstack.list.assert_any_call()
60 factoryMock.get_graph.assert_called_with(
61 simplify=
True, rank=
'same', ranksep=0.2, rankdir=
'TB')
62 factoryMock.create_dot.assert_called_with(graphMock)
65 if __name__ ==
'__main__':
67 rosunit.unitrun(PKG,
'test_packages_only', DotcodeGeneratorTest)
def test_packages_only(self)