Got pytest working. Basic boilerplate code done. Took a lot of work since I don't normally use Python for projects that are meant to be scaled.
This commit is contained in:
parent
0b6dc9ccac
commit
baf4ce69ba
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
**/.eggs
|
||||
**/.pytest_cache
|
||||
**/plugboardChatbotFramework.egg-info
|
||||
**/__pycache__
|
|
@ -1,14 +0,0 @@
|
|||
from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='plugboard-chatbot-framework',
|
||||
packages=find_packages(include=['plugboard-chatbot-framework']),
|
||||
version='0.1.0',
|
||||
description='Plugboard, a chatbot framework so you only have to write code once.',
|
||||
author='Innovation Science',
|
||||
license='GPLv3',
|
||||
install_requires=['asyncio','matrix-nio','os','ping3','urllib3','configparser'],
|
||||
setup_requires=['pytest-runner'],
|
||||
tests_require=['pytest==4.4.1'],
|
||||
test_suite='tests',
|
||||
)
|
|
@ -0,0 +1,12 @@
|
|||
# baseClient.py - An abstract method that acts as a blueprint for chatbot clients.
|
||||
#
|
||||
# (C) Innovation Science, Katie Martin
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class baseClient(ABC):
|
||||
|
||||
# Constructor
|
||||
@abstractmethod
|
||||
def __init__(self):
|
||||
pass
|
|
@ -0,0 +1 @@
|
|||
import matrix
|
|
@ -0,0 +1,22 @@
|
|||
# matrixClient.py - Implements baseClient.py, for use with Matrix homeservers.
|
||||
#
|
||||
# (C) Innovation Science, Katie Martin
|
||||
|
||||
from abc import ABC,abstractmethod
|
||||
import plugboardChatbotFramework.client.client as client
|
||||
|
||||
# I don't like this, but Python seems to be wanting to force my hand.
|
||||
class matrixClient(client.baseClient):
|
||||
username=''
|
||||
password=''
|
||||
botChannel=''
|
||||
serverAddr=''
|
||||
serverWebAddr=''
|
||||
|
||||
# Constructor
|
||||
def __init__(self, username='', password='', botChannel='', serverAddr='', serverWebAddr=''):
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.botChannel = botChannel
|
||||
self.serverAddr = serverAddr
|
||||
self.serverWebAddr = serverWebAddr
|
19
plugboardChatbotFramework/setup.py
Normal file
19
plugboardChatbotFramework/setup.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from setuptools import find_packages, setup
|
||||
#print(find_packages(include=['plugboardChatbotFramework']))
|
||||
|
||||
setup(
|
||||
name='plugboardChatbotFramework',
|
||||
packages=find_packages(),
|
||||
version='0.1.0',
|
||||
description='Plugboard, a chatbot framework so you only have to write code once.',
|
||||
author='Innovation Science',
|
||||
license='GPLv3',
|
||||
install_requires=['asyncio','matrix-nio','ping3','urllib3','configparser'],
|
||||
setup_requires=['pytest-runner'],
|
||||
tests_require=['pytest==7.4.0'],
|
||||
test_suite='tests',
|
||||
)
|
||||
|
||||
# install_requires=['asyncio','matrix-nio','os','ping3','urllib3','configparser'],
|
||||
# packages=find_packages(include=['plugboard-chatbot-framework']),
|
||||
# originally 4.4.1
|
11
plugboardChatbotFramework/tests/matrix/test_matrix.py
Normal file
11
plugboardChatbotFramework/tests/matrix/test_matrix.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
import plugboardChatbotFramework.matrix.matrix as matrix
|
||||
|
||||
def test_init():
|
||||
client = matrix.matrixClient()
|
||||
user = client.username
|
||||
assert user == ''
|
||||
|
||||
def test_getUsername():
|
||||
client = matrix.matrixClient()
|
||||
user = client.username
|
||||
assert user == ''
|
Loading…
Reference in a new issue