openwisp / openwisp/netengine

[chores] Improve test suite

Open
#60 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
42
Forks
18
Avg merge
12h 54m
Merged PRs (30d)
1

Description

Follow up to #48 / #46

  • 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)
  • Add tests for missing coverage. Most of the missing coverage can be easily tested. (To be done in #62)
  • Add .coveragerc file as done here: https://github.com/openwisp/openwisp-controller/blob/master/.coveragerc (Done in #59)
  • 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing tests.snmp.base.TestSNMP and the existing AirOS and OpenWrt backend tests. Check coverage for the listed OpenWRT and AirOS methods, then consider package-local tests and snmpsim for mocking. Done means the test organization and missing SNMP coverage have a decided, implemented approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.