File: fake_cli.py

package info (click to toggle)
pyegps 0.2.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180 kB
  • sloc: python: 554; makefile: 7; sh: 5
file content (18 lines) | stat: -rw-r--r-- 511 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Allows direct execution of CLI with dummy devices."""
from unittest.mock import patch
import sys
import os

sys.path.append( os.path.join(os.path.dirname(__file__), "..","src") )

import pyegps
from pyegps.fakes.powerstrip import FakePowerStrip

def take_dummy_devices():
    return patch("pyegps.search_for_devices", return_value=FakePowerStrip.search_for_devices() )


if __name__ == "__main__":
    with take_dummy_devices() as mock:
        from pyegps import cli
        sys.exit(cli.cli(sys.argv[1:]))