netengine icon indicating copy to clipboard operation
netengine copied to clipboard

[chores] Improve test suite

Open pandafy opened this issue 4 years ago • 0 comments

Follow up to #48 / #46

  • [x] Configure nose to automatically find test files. This will eliminate the need of importing modules in __init__.py. Prefixing test file names with test_ should do most of the work, (Done in #59)
  • [x] Add tests for missing coverage. Most of the missing coverage can be easily tested. (To be done in #62)
  • [x] Add .coveragerc file as done here: https://github.com/openwisp/openwisp-controller/blob/master/.coveragerc (Done in #59)
  • [x] Use logger instead of print statements. Check if there's a difference between logger module of Python 2 and Python 3. If there is, delegate this to https://github.com/openwisp/netengine/issues/49 (Done in #59)

Open for discussion

  • Consider moving some tests inside the package like we do for other modules. This enables users to run or extend tests.
  • Currently most parts of netengine.backends.snmp.SNMP are not tested directly in tests.snmp.base.TestSNMP but they are tested in tests for AirOS and OpenWrt backend. Do we want to keep it this way or find a way to make tests more modular?
  • There is lack of proper tests for following methods of netengine.backends.snmp.OpenWRT:
    • get_interfaces
    • interfaces_MAC
    • interfaces_speed
    • interfaces_state
    • interfaces_bytes
    • interfaces_type
    • interface_addr_and_mask
  • The above point also applies on netengine.backends.snmp.AirOS
  • Using snmpsim for mocking an SNMP device

pandafy avatar May 28 '21 13:05 pandafy