File: __init__.py

package info (click to toggle)
2ping 4.5-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 492 kB
  • sloc: python: 3,304; makefile: 44; sh: 4
file content (13 lines) | stat: -rw-r--r-- 372 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
import unittest.mock


def _test_module_init(module, main_name="main"):
    with unittest.mock.patch.object(
        module, main_name, return_value=0
    ), unittest.mock.patch.object(
        module, "__name__", "__main__"
    ), unittest.mock.patch.object(
        module.sys, "exit"
    ) as exit:
        module.module_init()
        return exit.call_args[0][0] == 0