From 9eeeefa1d2bbeb1f19df95e8337b841da3ed54b6 Mon Sep 17 00:00:00 2001 From: akinwale Date: Tue, 3 Oct 2017 10:16:24 +0100 Subject: [PATCH] Python unit tests (#13) * Modified build to allow Python unit tests to run * Added extra dependencies and build recipes for the unit tests --- buildozer.spec.sample | 2 +- buildozer.spec.travis | 2 +- .../bootstraps/lbry/build/blacklist.txt | 2 +- .../build/templates/AndroidManifest.tmpl.xml | 2 + .../templates/activity_service_control.xml | 44 +++++- .../lbry/build/templates/strings.tmpl.xml | 3 + recipes/cffi/__init__.py | 36 +++++ recipes/cffi/disable-pkg-config.patch | 29 ++++ recipes/cryptography/__init__.py | 30 +++++ recipes/ipaddress/__init__.py | 14 ++ recipes/pyasn1/__init__.py | 11 ++ recipes/unqlite/__init__.py | 32 +++++ recipes/unqlite/setup.patch | 26 ++++ .../java/io/lbry/lbrynet/LbrynetService.java | 40 ++---- .../lbrynet/LbrynetTestRunnerService.java | 126 ++++++++++++++++++ .../lbry/lbrynet/ServiceControlActivity.java | 79 ++++++++++- .../java/io/lbry/lbrynet/ServiceHelper.java | 30 +++++ src/main/python/lbrynetservice.py | 3 +- src/main/python/testrunnerservice.py | 76 +++++++++++ 19 files changed, 546 insertions(+), 41 deletions(-) create mode 100644 recipes/cffi/__init__.py create mode 100644 recipes/cffi/disable-pkg-config.patch create mode 100644 recipes/cryptography/__init__.py create mode 100644 recipes/ipaddress/__init__.py create mode 100644 recipes/pyasn1/__init__.py create mode 100644 recipes/unqlite/__init__.py create mode 100644 recipes/unqlite/setup.patch create mode 100644 src/main/java/io/lbry/lbrynet/LbrynetTestRunnerService.java create mode 100644 src/main/java/io/lbry/lbrynet/ServiceHelper.java create mode 100644 src/main/python/testrunnerservice.py diff --git a/buildozer.spec.sample b/buildozer.spec.sample index 9c5ecf6..9101dad 100644 --- a/buildozer.spec.sample +++ b/buildozer.spec.sample @@ -36,7 +36,7 @@ version = 0.1 # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = openssl, sqlite3, hostpython2, pycrypto==2.6.1, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbry +requirements = openssl, sqlite3, hostpython2, pycrypto==2.6.1, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, git+https://github.com/lbryio/lbryschema.git@v0.0.12rc1#egg=lbryschema, git+https://github.com/lbryio/lbryum.git@v3.1.9rc2#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.0.3, funcsigs, mock, pbr, unqlite # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.travis b/buildozer.spec.travis index d4abac0..722821e 100644 --- a/buildozer.spec.travis +++ b/buildozer.spec.travis @@ -36,7 +36,7 @@ version = 0.1 # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = openssl, sqlite3, hostpython2, pycrypto==2.6.1, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbry +requirements = openssl, sqlite3, hostpython2, pycrypto==2.6.1, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, git+https://github.com/lbryio/lbryschema.git@v0.0.12rc1#egg=lbryschema, git+https://github.com/lbryio/lbryum.git@v3.1.9rc2#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.0.3, funcsigs, mock, pbr, unqlite # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/p4a/pythonforandroid/bootstraps/lbry/build/blacklist.txt b/p4a/pythonforandroid/bootstraps/lbry/build/blacklist.txt index 3d596e4..72ebeaf 100644 --- a/p4a/pythonforandroid/bootstraps/lbry/build/blacklist.txt +++ b/p4a/pythonforandroid/bootstraps/lbry/build/blacklist.txt @@ -6,7 +6,7 @@ *.egg-info # unit test -unittest/* +#unittest/* # python config config/makesetup diff --git a/p4a/pythonforandroid/bootstraps/lbry/build/templates/AndroidManifest.tmpl.xml b/p4a/pythonforandroid/bootstraps/lbry/build/templates/AndroidManifest.tmpl.xml index d0a6660..f5c35e8 100644 --- a/p4a/pythonforandroid/bootstraps/lbry/build/templates/AndroidManifest.tmpl.xml +++ b/p4a/pythonforandroid/bootstraps/lbry/build/templates/AndroidManifest.tmpl.xml @@ -118,6 +118,8 @@ {% endfor %} + {% if args.billing_pubkey %} -