Пример #1
0
def create_envionment(device_name, destination):
    os.makedirs(destination, exist_ok=True)

    try:
        fake_device = fake_driver.FakeDevice(device_name, tmp_dir=destination)
        return fake_device
    except ValueError:
        print('Device {0}.cfg not found'.format(device_name))
Пример #2
0
    def setUpClass(cls):
        cls._daemon_dir = tempfile.mkdtemp(prefix='tmp_', suffix='_daemondata')
        cls._tmp_dir = tempfile.mkdtemp(prefix='tmp_', suffix='_daemontest')

        cls._bw_serial = 'IO0000000000001'
        cls._bw_chroma = fake_driver.FakeDevice('razerblackwidowchroma',
                                                serial=cls._bw_serial,
                                                tmp_dir=cls._tmp_dir)
        print("Created BlackWidow Chroma endpoints")

        cls._daemon_proc = multiprocessing.Process(target=run_daemon,
                                                   args=(cls._daemon_dir,
                                                         cls._tmp_dir))
        cls._daemon_proc.start()
        print("Started daemon")
        time.sleep(5)