Load onionshare_cli from source tree instead of pip dependency, and start making tests work with PySide2

This commit is contained in:
Micah Lee 2020-10-14 20:17:08 -07:00
parent 415618b74a
commit 79100f050c
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
12 changed files with 261 additions and 201 deletions

View file

@ -9,9 +9,33 @@ sys.onionshare_test_mode = True
import os
import shutil
import tempfile
from datetime import datetime, timedelta
import pytest
from PySide2 import QtTest, QtGui
@staticmethod
def qWait(t, qtapp):
end = datetime.now() + timedelta(milliseconds=t)
while datetime.now() < end:
qtapp.processEvents()
# Monkeypatch qWait, because PySide2 doesn't have it
# https://stackoverflow.com/questions/17960159/qwait-analogue-in-pyside
QtTest.QTest.qWait = qWait
# Allow importing onionshare_cli from the source tree
sys.path.insert(
0,
os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
"cli",
),
)
from onionshare_cli import common, web, settings