From 71a390b5783a2be8266dfd5970b3b598c91bab08 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Tue, 30 Aug 2022 18:25:01 +0530 Subject: [PATCH] Add kivy mock network and update setup file --- .buildbot/kivy/build.sh | 2 ++ setup.py | 3 +++ src/mock/kivy_main.py | 1 + src/mock/network.py | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 src/mock/network.py diff --git a/.buildbot/kivy/build.sh b/.buildbot/kivy/build.sh index afd6b81a..87aae8f7 100755 --- a/.buildbot/kivy/build.sh +++ b/.buildbot/kivy/build.sh @@ -2,4 +2,6 @@ pip3 install -r kivy-requirements.txt +export INSTALL_TESTS=True + pip3 install . diff --git a/setup.py b/setup.py index 2ec36d4f..85c83ce1 100644 --- a/setup.py +++ b/setup.py @@ -78,6 +78,9 @@ if __name__ == "__main__": if sys.version_info[0] == 3: packages.extend(['pybitmessage.bitmessagekivy', 'pybitmessage.bitmessagekivy.baseclass']) + if os.environ.get('INSTALL_TESTS', False): + packages.append('pybitmessage.mock') + # this will silently accept alternative providers of msgpack # if they are already installed diff --git a/src/mock/kivy_main.py b/src/mock/kivy_main.py index 7fe330f6..0cffb9cf 100644 --- a/src/mock/kivy_main.py +++ b/src/mock/kivy_main.py @@ -7,6 +7,7 @@ from pybitmessage.bitmessagekivy.mpybit import NavigateApp import multiqueue from class_addressGenerator import FakeAddressGenerator +from pybitmessage.mock.network import stats, objectracker def main(): diff --git a/src/mock/network.py b/src/mock/network.py new file mode 100644 index 00000000..7380387a --- /dev/null +++ b/src/mock/network.py @@ -0,0 +1,18 @@ +# pylint: disable=too-few-public-methods + +""" + Mock Network +""" + + +class objectracker(object): + """Mock object tracker""" + missingObjects = {} + + +class stats(object): + """Mock network statics""" + @staticmethod + def connectedHostsList(): + """List of all the connected hosts""" + return ()