napalm icon indicating copy to clipboard operation
napalm copied to clipboard

use unittest.mock instead of mock

Open pgajdos opened this issue 3 years ago • 4 comments

Description of Issue/Question

Could you please consider to use unittest.mock instead of mock, as a fallback at least?

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

(Place an x between the square brackets where applicable)

  • [] Yes
  • [x] No

Setup

napalm version

(Paste verbatim output from pip freeze | grep napalm between quotes below)

git master

Network operating system version

(Paste verbatim output from show version - or equivalent - between quotes below)

N/A

Steps to Reproduce the Issue

Error Traceback

(Paste the complete traceback of the exception between quotes below)

run the testsuite without python-mock installed

pgajdos avatar Mar 24 '22 12:03 pgajdos

I am not really following your issue--you don't want to install and use the Python mock library?

ktbyers avatar Mar 24 '22 16:03 ktbyers

Yes, this issue is meant this way: in case mock is not available, we could use built-in unittest.mock instead.

JFYI, I tried just mock -> unittest.mock (https://build.opensuse.org/package/view_file/home:pgajdos:python/python-napalm/python-napalm-no-mock.patch) and this works at least for 3.{8,9,10}. Background: https://trello.com/b/WsskhdXA/opensuse-python

pgajdos avatar Mar 25 '22 06:03 pgajdos

I'm not opposed, feel free to open a PR and we shall review @pgajdos!

mirceaulinic avatar May 20 '22 09:05 mirceaulinic

Yeah, I am not opposed to this either, but you would probably need to do the pull-request on it.

This is entirely a NAPALM development dependency so not sure why you care?

ktbyers avatar Sep 13 '22 22:09 ktbyers