Skip to content

Commit

Permalink
Merge pull request #1159 from balasankarrajaguru/fix_lxml_version
Browse files Browse the repository at this point in the history
Fix lxml version
  • Loading branch information
dineshbaburam91 committed Feb 28, 2022
2 parents d3c065a + 167d319 commit 048f750
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/jnpr/junos/factory/table.py
Expand Up @@ -245,7 +245,9 @@ def savexml(self, path, hostname=False, timestamp=False, append=None):
fname += "_%s" % append

path = fname + fext
return etree.ElementTree(self.xml).write(open(path, "wb"))
with open(path, "wb+") as f:
pass
return etree.ElementTree(self.xml).write(path)

def to_json(self):
"""
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/factory/test_table.py
Expand Up @@ -139,9 +139,9 @@ def test_table_get_RuntimeError(self):
def test_table_savexml(self, mock_file, mock_execute):
mock_execute.side_effect = self._mock_manager
self.ppt.xml = etree.XML("<root><a>test</a></root>")
self.ppt.savexml("/vasr/tmssp/foo.xml", hostname=True, append="test")
mock_file.assert_called_once_with("/vasr/tmssp/foo_1.1.1.1_test.xml", "wb")
self.ppt.savexml("/vasr/tmssp/foo.xml", hostname=True, timestamp=True)
self.ppt.savexml("foo.xml", hostname=True, append="test")
mock_file.assert_called_once_with("foo_1.1.1.1_test.xml", "wb+")
self.ppt.savexml("foo.xml", hostname=True, timestamp=True)
self.assertEqual(mock_file.call_count, 2)

def _read_file(self, fname):
Expand Down

0 comments on commit 048f750

Please sign in to comment.