Skip to content
Snippets Groups Projects
Commit 6bdf88cb authored by inso's avatar inso
Browse files

Run test throught setup.py test

parent be9f961d
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,6 @@ pyrcc5 -version ...@@ -11,6 +11,6 @@ pyrcc5 -version
lrelease -version lrelease -version
python -m unittest discover --start-directory src/sakia/tests -t src python setup.py test
if %errorlevel% neq 0 exit /b 1 if %errorlevel% neq 0 exit /b 1
\ No newline at end of file
...@@ -23,6 +23,5 @@ then ...@@ -23,6 +23,5 @@ then
elif [ $TRAVIS_OS_NAME == "linux" ] elif [ $TRAVIS_OS_NAME == "linux" ]
then then
python setup.py build python setup.py build
cp $HOME/.pyenv/versions/$PYENV_PYTHON_VERSION/lib/libpython3.*m.so.1.0 build/exe.linux-x86_64-3.*/
fi fi
...@@ -14,5 +14,5 @@ then ...@@ -14,5 +14,5 @@ then
sleep 3 sleep 3
fi fi
coverage run --source=sakia.core,sakia.gui,sakia.models python -m unittest discover --start-directory src/sakia/tests -t src coverage run --source=sakia.core,sakia.gui,sakia.models python setup.py test
...@@ -3,123 +3,124 @@ from cx_Freeze import setup, Executable ...@@ -3,123 +3,124 @@ from cx_Freeze import setup, Executable
from PyQt5 import QtCore from PyQt5 import QtCore
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
import unittest
#############################################################################
# preparation des options
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))
print(sys.path) if "test" in sys.argv:
print("Environnement:") runner = unittest.TextTestRunner().run(unittest.defaultTestLoader.discover(start_dir='sakia.tests',
print(os.environ) pattern='test_*'))
includes = ["sip", "re", "json", "logging",
"hashlib", "os", "urllib",
"ucoinpy", "pylibscrypt", "aiohttp", "asyncio",
"quamash", "jsonschema"]
exclude = ['.git']
packages = ["libnacl", "encodings"]
includefiles = []
zipincludes = []
if sys.platform == "win32":
app = QtCore.QCoreApplication(sys.argv)
libEGL_path = ""
libsodium_path = ""
print(QtCore.QCoreApplication.libraryPaths())
for path in QtCore.QCoreApplication.libraryPaths():
if os.path.isfile(os.path.join(os.path.dirname(path), "libEGL.dll")):
libEGL_path = os.path.join(os.path.dirname(path), "libEGL.dll")
if 'CONDA_DEFAULT_ENV' in os.environ:
# Check if we are in Conda env
schemas = os.path.join(site.getsitepackages()[1], "jsonschema", "schemas")
sys.exit(not runner.wasSuccessful())
else:
print(sys.path)
print("Environnement:")
print(os.environ)
includes = ["sip", "re", "json", "logging",
"hashlib", "os", "urllib",
"ucoinpy", "pylibscrypt", "aiohttp", "asyncio",
"quamash", "jsonschema"]
exclude = ['.git']
packages = ["libnacl", "encodings"]
includefiles = []
zipincludes = []
if sys.platform == "win32":
app = QtCore.QCoreApplication(sys.argv)
libEGL_path = ""
libsodium_path = ""
print(QtCore.QCoreApplication.libraryPaths())
for path in QtCore.QCoreApplication.libraryPaths():
if os.path.isfile(os.path.join(os.path.dirname(path), "libEGL.dll")):
libEGL_path = os.path.join(os.path.dirname(path), "libEGL.dll")
if 'CONDA_DEFAULT_ENV' in os.environ:
# Check if we are in Conda env
schemas = os.path.join(site.getsitepackages()[1], "jsonschema", "schemas")
onlyfiles = [ f for f in listdir(schemas) if isfile(join(schemas,f)) ]
for f in onlyfiles:
zipincludes.append((os.path.join(schemas, f), os.path.join("jsonschema", "schemas", f)))
path = QtCore.QCoreApplication.libraryPaths()[0]
libEGL_path = os.path.join(path, "Scripts", "libEGL.dll")
libsodium_path = os.path.join(path, "Scripts", "libsodium.dll")
files = lambda mypath: [ f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath,f)) ]
for f in files(os.path.join(path, "Scripts", "plugins", "platforms")):
includefiles.append((os.path.join(path, "Scripts", "plugins", "platforms", f), os.path.join("platforms", f) ))
for f in files(os.path.join(path, "Scripts", "plugins", "imageformats")):
includefiles.append((os.path.join(path, "Scripts", "plugins", "imageformats", f), os.path.join("imageformats", f) ))
for f in files(os.path.join(path, "Scripts", "plugins", "iconengines")):
includefiles.append((os.path.join(path, "Scripts", "plugins", "iconengines", f), os.path.join("iconengines", f) ))
includefiles.append(libEGL_path)
includefiles.append(libsodium_path)
else:
schemas = os.path.join(site.getsitepackages()[0], "jsonschema", "schemas")
onlyfiles = [ f for f in listdir(schemas) if isfile(join(schemas,f)) ] onlyfiles = [ f for f in listdir(schemas) if isfile(join(schemas,f)) ]
for f in onlyfiles: for f in onlyfiles:
zipincludes.append((os.path.join(schemas, f), os.path.join("jsonschema", "schemas", f))) zipincludes.append((os.path.join(schemas, f), os.path.join("jsonschema", "schemas", f)))
path = QtCore.QCoreApplication.libraryPaths()[0] if sys.platform == "darwin":
libEGL_path = os.path.join(path, "Scripts", "libEGL.dll") info = subprocess.check_output(["brew", "info", "libsodium"])
libsodium_path = os.path.join(path, "Scripts", "libsodium.dll") info = info.decode().splitlines(keepends=False)
if len(info) > 1:
files = lambda mypath: [ f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath,f)) ] library_path = info[3].split(" ")[0]
for f in files(os.path.join(path, "Scripts", "plugins", "platforms")): libsodium_path = os.path.join(library_path, "lib",
includefiles.append((os.path.join(path, "Scripts", "plugins", "platforms", f), os.path.join("platforms", f) )) "libsodium.dylib")
includefiles.append((libsodium_path, "lib/libsodium.dylib"))
for f in files(os.path.join(path, "Scripts", "plugins", "imageformats")): print(libsodium_path)
includefiles.append((os.path.join(path, "Scripts", "plugins", "imageformats", f), os.path.join("imageformats", f) )) else:
print("Erreur : libsodium not found. Please install it with brew install libsodium.")
for f in files(os.path.join(path, "Scripts", "plugins", "iconengines")):
includefiles.append((os.path.join(path, "Scripts", "plugins", "iconengines", f), os.path.join("iconengines", f) )) qtconf_path = os.path.join(os.path.dirname(__file__), "res/osx/qt.conf")
includefiles.append(libEGL_path) includefiles.append((qtconf_path, "qt.conf"))
includefiles.append(libsodium_path)
else: print("Includes : ")
schemas = os.path.join(site.getsitepackages()[0], "jsonschema", "schemas") print(includes)
onlyfiles = [ f for f in listdir(schemas) if isfile(join(schemas,f)) ] print("Excludes : ")
for f in onlyfiles: print(exclude)
zipincludes.append((os.path.join(schemas, f), os.path.join("jsonschema", "schemas", f))) print("Include files : ")
print(includefiles)
if sys.platform == "darwin": print("Zip files : ")
info = subprocess.check_output(["brew", "info", "libsodium"]) print(zipincludes)
info = info.decode().splitlines(keepends=False) print("Packages : ")
if len(info) > 1: print(packages)
library_path = info[3].split(" ")[0] print("Sys.path : ")
libsodium_path = os.path.join(library_path, "lib", print(sys.path)
"libsodium.dylib")
includefiles.append((libsodium_path, "lib/libsodium.dylib")) options = {"path": sys.path,
print(libsodium_path) "includes": includes,
else: "include_files": includefiles,
print("Erreur : libsodium not found. Please install it with brew install libsodium.") "excludes": exclude,
"packages": packages,
qtconf_path = os.path.join(os.path.dirname(__file__), "res/osx/qt.conf") "zip_includes": zipincludes
includefiles.append((qtconf_path, "qt.conf")) }
print("Includes : ") base = None
print(includes) file_type=""
print("Excludes : ") icon="sakia.png"
print(exclude) if sys.platform == "win32":
print("Include files : ") base = "Win32GUI"
print(includefiles) file_type=".exe"
print("Zip files : ") icon="sakia.ico"
print(zipincludes)
print("Packages : ") target = Executable(
print(packages) script = "src/sakia/main.py",
print("Sys.path : ") targetName="sakia"+file_type,
print(sys.path) base = base,
icon = icon,
options = {"path": sys.path, )
"includes": includes,
"include_files": includefiles, setup(
"excludes": exclude, name = "sakia",
"packages": packages, version = "0.11.2",
"zip_includes": zipincludes description = "UCoin client",
} author = "Inso",
options = {"build_exe": options},
############################################################################# executables = [target]
# preparation des cibles )
base = None
file_type=""
icon="sakia.png"
if sys.platform == "win32":
base = "Win32GUI"
file_type=".exe"
icon="sakia.ico"
target = Executable(
script = "src/sakia/main.py",
targetName="sakia"+file_type,
base = base,
icon = icon,
)
#############################################################################
# creation du setup
setup(
name = "sakia",
version = "0.11.2",
description = "UCoin client",
author = "Inso",
options = {"build_exe": options},
executables = [target]
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment