mirror of
https://github.com/onionshare/onionshare.git
synced 2025-08-18 19:08:24 -04:00
Load onionshare_cli from source tree instead of pip dependency, and start making tests work with PySide2
This commit is contained in:
parent
415618b74a
commit
79100f050c
12 changed files with 261 additions and 201 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue