Build tests into the windows bundle if DEBUG=True is set in pyinstaller spec
This commit is contained in:
parent
6310fc8919
commit
78e16e61a0
|
@ -7,6 +7,7 @@ import time
|
||||||
from PyInstaller.utils.hooks import copy_metadata
|
from PyInstaller.utils.hooks import copy_metadata
|
||||||
|
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
site_root = os.path.abspath(HOMEPATH)
|
site_root = os.path.abspath(HOMEPATH)
|
||||||
spec_root = os.path.abspath(SPECPATH)
|
spec_root = os.path.abspath(SPECPATH)
|
||||||
arch = 32 if ctypes.sizeof(ctypes.c_voidp) == 4 else 64
|
arch = 32 if ctypes.sizeof(ctypes.c_voidp) == 4 else 64
|
||||||
|
@ -25,6 +26,10 @@ snapshot = False
|
||||||
|
|
||||||
hookspath = os.path.join(spec_root, 'hooks')
|
hookspath = os.path.join(spec_root, 'hooks')
|
||||||
|
|
||||||
|
excludes = ['bsddb', 'bz2', 'tcl', 'tk', 'Tkinter', 'tests']
|
||||||
|
if not DEBUG:
|
||||||
|
excludes += ['pybitmessage.tests', 'pyelliptic.tests']
|
||||||
|
|
||||||
a = Analysis(
|
a = Analysis(
|
||||||
[os.path.join(srcPath, 'bitmessagemain.py')],
|
[os.path.join(srcPath, 'bitmessagemain.py')],
|
||||||
datas=[
|
datas=[
|
||||||
|
@ -39,7 +44,7 @@ a = Analysis(
|
||||||
'plugins.menu_qrcode', 'plugins.proxyconfig_stem'
|
'plugins.menu_qrcode', 'plugins.proxyconfig_stem'
|
||||||
],
|
],
|
||||||
runtime_hooks=[os.path.join(hookspath, 'pyinstaller_rthook_plugins.py')],
|
runtime_hooks=[os.path.join(hookspath, 'pyinstaller_rthook_plugins.py')],
|
||||||
excludes=['bsddb', 'bz2', 'tcl', 'tk', 'Tkinter', 'tests']
|
excludes=excludes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,10 +127,10 @@ exe = EXE(
|
||||||
a.zipfiles,
|
a.zipfiles,
|
||||||
a.datas,
|
a.datas,
|
||||||
name=fname,
|
name=fname,
|
||||||
debug=False,
|
debug=DEBUG,
|
||||||
strip=None,
|
strip=None,
|
||||||
upx=False,
|
upx=False,
|
||||||
console=False, icon=os.path.join(srcPath, 'images', 'can-icon.ico')
|
console=DEBUG, icon=os.path.join(srcPath, 'images', 'can-icon.ico')
|
||||||
)
|
)
|
||||||
|
|
||||||
coll = COLLECT(
|
coll = COLLECT(
|
||||||
|
|
|
@ -312,6 +312,9 @@ class Main(object):
|
||||||
try:
|
try:
|
||||||
# pylint: disable=relative-import
|
# pylint: disable=relative-import
|
||||||
from tests import core as test_core
|
from tests import core as test_core
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
from pybitmessage.tests import core as test_core
|
||||||
except ImportError:
|
except ImportError:
|
||||||
self.stop()
|
self.stop()
|
||||||
return
|
return
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if getattr(sys, 'frozen', None):
|
||||||
|
from test_arithmetic import TestArithmetic
|
||||||
|
from test_blindsig import TestBlindSig
|
||||||
|
from test_openssl import TestOpenSSL
|
||||||
|
|
||||||
|
__all__ = ["TestArithmetic", "TestBlindSig", "TestOpenSSL"]
|
|
@ -0,0 +1,13 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if getattr(sys, 'frozen', None):
|
||||||
|
from test_addresses import TestAddresses
|
||||||
|
from test_crypto import TestHighlevelcrypto
|
||||||
|
from test_l10n import TestL10n
|
||||||
|
from test_packets import TestSerialize
|
||||||
|
from test_protocol import TestProtocol
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"TestAddresses", "TestHighlevelcrypto", "TestL10n",
|
||||||
|
"TestProtocol", "TestSerialize"
|
||||||
|
]
|
|
@ -40,6 +40,7 @@ try:
|
||||||
except (OSError, socket.error):
|
except (OSError, socket.error):
|
||||||
tor_port_free = False
|
tor_port_free = False
|
||||||
|
|
||||||
|
frozen = getattr(sys, 'frozen', None)
|
||||||
knownnodes_file = os.path.join(state.appdata, 'knownnodes.dat')
|
knownnodes_file = os.path.join(state.appdata, 'knownnodes.dat')
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,6 +299,7 @@ class TestCore(unittest.TestCase):
|
||||||
return
|
return
|
||||||
self.fail('Failed to find at least 3 nodes to connect within 360 sec')
|
self.fail('Failed to find at least 3 nodes to connect within 360 sec')
|
||||||
|
|
||||||
|
@unittest.skipIf(frozen, 'skip fragile test')
|
||||||
def test_udp(self):
|
def test_udp(self):
|
||||||
"""check default udp setting and presence of Announcer thread"""
|
"""check default udp setting and presence of Announcer thread"""
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
|
@ -370,6 +372,7 @@ class TestCore(unittest.TestCase):
|
||||||
'''select typeof(msgid) from sent where ackdata=?''', result)
|
'''select typeof(msgid) from sent where ackdata=?''', result)
|
||||||
self.assertEqual(column_type[0][0] if column_type else '', 'text')
|
self.assertEqual(column_type[0][0] if column_type else '', 'text')
|
||||||
|
|
||||||
|
@unittest.skipIf(frozen, 'not packed test_pattern into the bundle')
|
||||||
def test_old_knownnodes_pickle(self):
|
def test_old_knownnodes_pickle(self):
|
||||||
"""Testing old (v0.6.2) version knownnodes.dat file"""
|
"""Testing old (v0.6.2) version knownnodes.dat file"""
|
||||||
try:
|
try:
|
||||||
|
@ -411,10 +414,21 @@ class TestCore(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
"""Starts all tests defined in this module"""
|
"""Starts all tests intended for core run"""
|
||||||
loader = unittest.defaultTestLoader
|
loader = unittest.defaultTestLoader
|
||||||
loader.sortTestMethodsUsing = None
|
loader.sortTestMethodsUsing = None
|
||||||
suite = loader.loadTestsFromTestCase(TestCore)
|
suite = loader.loadTestsFromTestCase(TestCore)
|
||||||
|
if frozen:
|
||||||
|
try:
|
||||||
|
from pybitmessage import tests
|
||||||
|
suite.addTests(loader.loadTestsFromModule(tests))
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
from pyelliptic import tests
|
||||||
|
suite.addTests(loader.loadTestsFromModule(tests))
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
import bitmessageqt.tests
|
import bitmessageqt.tests
|
||||||
from xvfbwrapper import Xvfb
|
from xvfbwrapper import Xvfb
|
||||||
|
|
Reference in New Issue
Block a user