Skip to content

Commit

Permalink
[xcvrd] Fix unit test issue with Python 3 (#135)
Browse files Browse the repository at this point in the history
Why I did this?

xcvrd unit test failed when building it with python3: 

```
17:23:50  _____________________ ERROR collecting tests/test_xcvrd.py _____________________
17:23:50  tests/test_xcvrd.py:36: in <module>
17:23:50      class TestXcvrdScript(object):
17:23:50  tests/test_xcvrd.py:41: in TestXcvrdScript
17:23:50      @patch('xcvrd.xcvrd.logical_port_name_to_physical_port_list', MagicMock(return_value=[0]))
17:23:50  E   NameError: name 'patch' is not defined
```

How I did this?
import the package patch
  • Loading branch information
Junchao-Mellanox authored Dec 18, 2020
1 parent b674dff commit e6c786b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
from imp import load_source
if sys.version_info >= (3, 3):
from unittest.mock import MagicMock
from unittest.mock import MagicMock, patch
else:
from mock import MagicMock, patch

Expand Down

0 comments on commit e6c786b

Please sign in to comment.