Broke out wrapper_tests to toxygen_wrapper
This commit is contained in:
parent
c5edc1f01b
commit
695d8e2cf9
@ -9,8 +9,8 @@ from time import sleep
|
||||
from gevent import monkey; monkey.patch_all(); del monkey # noqa
|
||||
import gevent
|
||||
|
||||
import tests.support_testing as ts
|
||||
from tests.tests_wrapper import bootstrap_iNodeInfo
|
||||
import wrapper_tests.support_testing as ts
|
||||
from wrapper_tests.tests_wrapper import bootstrap_iNodeInfo
|
||||
from user_data import settings
|
||||
|
||||
IDLE_PERIOD = 0.10
|
||||
@ -117,8 +117,8 @@ from contacts.group_peer_factory import GroupPeerFactory
|
||||
from user_data.backup_service import BackupService
|
||||
import styles.style # TODO: dynamic loading
|
||||
|
||||
from tests.support_testing import lLOCAL, lGOOD, lNEW, lRELAYS
|
||||
from tests.tests_wrapper import main as oTOX_OPTIONS, iMain, ToxOptions, iNodeInfo
|
||||
from wrapper_tests.support_testing import lLOCAL, lGOOD, lNEW, lRELAYS
|
||||
from wrapper_tests.tests_wrapper import main as oTOX_OPTIONS, iMain, ToxOptions, iNodeInfo
|
||||
|
||||
global iI
|
||||
iI = 0
|
||||
|
@ -10,7 +10,7 @@ from av.call import Call
|
||||
import common.tox_save
|
||||
|
||||
from utils import ui as util_ui
|
||||
import tests.support_testing as ts
|
||||
import wrapper_tests.support_testing as ts
|
||||
from middleware.threads import invoke_in_main_thread
|
||||
from main import sleep
|
||||
from middleware.threads import BaseThread
|
||||
|
@ -5,18 +5,14 @@ from utils.util import *
|
||||
from PyQt5 import QtNetwork
|
||||
from PyQt5 import QtCore
|
||||
try:
|
||||
import requests
|
||||
except ImportError:
|
||||
requests = None
|
||||
try:
|
||||
import pycurl
|
||||
import certifi
|
||||
from io import BytesIO
|
||||
except ImportError:
|
||||
pycurl = None
|
||||
certifi = None
|
||||
|
||||
from user_data.settings import get_user_config_path
|
||||
from tests.support_testing import download_url, _get_nodes_path
|
||||
from wrapper_tests.support_testing import _get_nodes_path
|
||||
from wrapper_tests.support_http import download_url
|
||||
|
||||
global LOG
|
||||
import logging
|
||||
@ -33,7 +29,7 @@ def download_nodes_list(settings, oArgs):
|
||||
result = fl.read()
|
||||
return result
|
||||
LOG.debug("downloading list of nodes")
|
||||
result = download_url(url, settings._app)
|
||||
result = download_url(url, settings._app._settings)
|
||||
if not result:
|
||||
LOG.warn("failed downloading list of nodes")
|
||||
return ''
|
||||
|
@ -40,7 +40,10 @@ class ContactsManager(ToxSave):
|
||||
self._history = history
|
||||
self._load_contacts()
|
||||
|
||||
def _log(self, s): self._ms(s)
|
||||
def _log(self, s):
|
||||
try:
|
||||
self._ms._log(s)
|
||||
except: pass
|
||||
|
||||
def get_contact(self, num):
|
||||
if num < 0 or num >= len(self._contacts):
|
||||
@ -431,6 +434,7 @@ class ContactsManager(ToxSave):
|
||||
:param message: additional message
|
||||
:return: True on success else error string
|
||||
"""
|
||||
retval = ''
|
||||
try:
|
||||
message = message or 'Hello! Add me to your contact list please'
|
||||
if len(tox_id) == TOX_PUBLIC_KEY_SIZE * 2: # public key
|
||||
|
@ -3,7 +3,7 @@ from messenger.messages import *
|
||||
from ui.contact_items import *
|
||||
import utils.util as util
|
||||
from common.tox_save import ToxSave
|
||||
from tests.support_testing import assert_main_thread
|
||||
from wrapper_tests.support_testing import assert_main_thread
|
||||
from copy import deepcopy
|
||||
|
||||
# LOG=util.log
|
||||
|
@ -12,7 +12,7 @@ faulthandler.enable()
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
import tests.support_testing as ts
|
||||
import wrapper_tests.support_testing as ts
|
||||
try:
|
||||
from trepan.interfaces import server as Mserver
|
||||
from trepan.api import debug
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||
import common.tox_save as tox_save
|
||||
from messenger.messages import *
|
||||
from tests.support_testing import assert_main_thread
|
||||
from wrapper_tests.support_testing import assert_main_thread
|
||||
|
||||
global LOG
|
||||
import logging
|
||||
@ -170,7 +170,9 @@ class Messenger(tox_save.ToxSave):
|
||||
return
|
||||
assert_main_thread()
|
||||
|
||||
# FixMe: peer_id is None?
|
||||
group_peer_contact = self._contacts_manager.get_or_create_group_peer_contact(group_number, peer_id)
|
||||
# group_peer_contact now may be None
|
||||
group = self._get_group_by_number(group_number)
|
||||
messages = self._split_message(text.encode('utf-8'))
|
||||
t = util.get_unix_time()
|
||||
|
@ -6,7 +6,7 @@ from PyQt5 import QtCore
|
||||
|
||||
from bootstrap.bootstrap import *
|
||||
from bootstrap.bootstrap import download_nodes_list
|
||||
import tests.support_testing as ts
|
||||
import wrapper_tests.support_testing as ts
|
||||
from utils import util
|
||||
|
||||
if 'QtCore' in sys.modules:
|
||||
|
@ -6,7 +6,7 @@ import wave
|
||||
|
||||
from ui import widgets
|
||||
import utils.util as util
|
||||
import tests.support_testing as ts
|
||||
import wrapper_tests.support_testing as ts
|
||||
|
||||
global LOG
|
||||
import logging
|
||||
|
@ -7,7 +7,7 @@ from utils.util import *
|
||||
from ui.widgets import CenteredWidget, DataLabel, LineEdit, RubberBandWindow
|
||||
import updater.updater as updater
|
||||
import utils.ui as util_ui
|
||||
import tests.support_testing as ts
|
||||
import wrapper_tests.support_testing as ts
|
||||
from user_data import settings
|
||||
|
||||
global LOG
|
||||
@ -56,9 +56,10 @@ class AddContact(CenteredWidget):
|
||||
self._adding = False
|
||||
if send is True:
|
||||
# request was successful
|
||||
self.close()
|
||||
else: # print error data
|
||||
pass
|
||||
elif send and type(send) == str: # print error data
|
||||
self.errorLabel.setText(send)
|
||||
self.close()
|
||||
|
||||
def _retranslate_ui(self):
|
||||
self.setWindowTitle(util_ui.tr('Add contact'))
|
||||
|
@ -1,7 +1,8 @@
|
||||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from platform import system
|
||||
import json
|
||||
import os
|
||||
from pprint import pprint
|
||||
|
||||
from utils.util import *
|
||||
@ -10,7 +11,7 @@ from common.event import Event
|
||||
import utils.ui as util_ui
|
||||
import utils.util as util_utils
|
||||
import user_data
|
||||
import tests.support_testing as ts
|
||||
import wrapper_tests.support_testing as ts
|
||||
|
||||
global LOG
|
||||
import logging
|
||||
@ -210,10 +211,15 @@ class Settings(dict):
|
||||
text = bytes(self._toxes.pass_encrypt(bytes(text, 'utf-8')))
|
||||
else:
|
||||
text = bytes(text, 'utf-8')
|
||||
with open(self._path, 'wb') as fl:
|
||||
fl.write(text)
|
||||
|
||||
self._settings_saved_event(text)
|
||||
tmp = self._path + str(os.getpid())
|
||||
try:
|
||||
with open(tmp, 'wb') as fl:
|
||||
fl.write(text)
|
||||
os.rename(tmp, self._path)
|
||||
except Exception as e:
|
||||
LOG.warn(f'Error saving to {self._path} ' +str(e))
|
||||
else:
|
||||
self._settings_saved_event(text)
|
||||
|
||||
def close(self):
|
||||
path = self._profile_path + '.lock'
|
||||
|
Loading…
Reference in New Issue
Block a user