(self, module, ffi=True)
| 544 | return accounts |
| 545 | |
| 546 | def run_bot_process(self, module, ffi=True): |
| 547 | fn = module.__file__ |
| 548 | |
| 549 | bot_cfg = self.get_next_liveconfig() |
| 550 | bot_ac = self.prepare_account_from_liveconfig(bot_cfg) |
| 551 | self._acsetup.start_configure(bot_ac) |
| 552 | self.wait_configured(bot_ac) |
| 553 | bot_ac.start_io() |
| 554 | # Wait for DC_EVENT_IMAP_INBOX_IDLE so that all emails appeared in the bot's Inbox later are |
| 555 | # considered new and not existing ones, and thus processed by the bot. |
| 556 | print(bot_ac._logid, "waiting for inbox IDLE to become ready") |
| 557 | bot_ac._evtracker.wait_idle_inbox_ready() |
| 558 | bot_ac.stop_io() |
| 559 | self._acsetup._account2state[bot_ac] = self._acsetup.IDLEREADY |
| 560 | |
| 561 | # Forget ac as it will be opened by the bot subprocess |
| 562 | # but keep something in the list to not confuse account generation |
| 563 | self._accounts[self._accounts.index(bot_ac)] = None |
| 564 | |
| 565 | args = [ |
| 566 | sys.executable, |
| 567 | "-u", |
| 568 | fn, |
| 569 | "--email", |
| 570 | bot_cfg["addr"], |
| 571 | "--password", |
| 572 | bot_cfg["mail_pw"], |
| 573 | bot_ac.db_path, |
| 574 | ] |
| 575 | if ffi: |
| 576 | args.insert(-1, "--show-ffi") |
| 577 | print("$", " ".join(args)) |
| 578 | popen = subprocess.Popen( |
| 579 | args=args, |
| 580 | stdin=subprocess.DEVNULL, |
| 581 | stdout=subprocess.PIPE, |
| 582 | stderr=subprocess.STDOUT, # combine stdout/stderr in one stream |
| 583 | bufsize=0, # line buffering |
| 584 | close_fds=True, # close all FDs other than 0/1/2 |
| 585 | universal_newlines=True, # give back text |
| 586 | ) |
| 587 | bot = BotProcess(popen, addr=bot_cfg["addr"]) |
| 588 | self._finalizers.append(bot.kill) |
| 589 | return bot |
| 590 | |
| 591 | def dump_imap_summary(self, logfile): |
| 592 | for ac in self._accounts: |
no test coverage detected