-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add python client #170
Conversation
Co-Authored-By: Rahmat Hidayat <rahmatramahidayat@gmail.com>
clients/python/.gitignore
Outdated
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you copy this from somewhere else @prakharmathur82 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it must have been from some project, removed this, and added gitignore from https://github.com/github/gitignore/blob/main/Python.gitignore
clients/python/requirements.txt
Outdated
protobuf==3.17.3 | ||
pytest==6.0.1 | ||
pytest-cov==2.12.1 | ||
mock==4.0.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use unittest.mock
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
self._scheduler = Scheduler() | ||
if self._auto_refresh: | ||
self._scheduler.every(self._interval).seconds.do(self.refresh) | ||
#TODO: check whether scheduler executed immediatelly or not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When are we going to test this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked it, it starts after 1st schedule
clients/python/README.md
Outdated
|
||
Use `pip` | ||
``` | ||
pip3 install stencil-python-client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update this to use the git based method for downloading ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
@@ -0,0 +1,30 @@ | |||
from .store import Store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use absolute path instead of relative path ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
clients/python/test/test_client.py
Outdated
client = Client(URL) | ||
|
||
assert client.get_descriptor('test.One') | ||
assert client.get_descriptor('test.faile') is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
clients/python/test/test_client.py
Outdated
@@ -0,0 +1,26 @@ | |||
from src.raystack.stencil import Client | |||
from src.raystack.store import Store | |||
from mock import patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use unittest.mock instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
clients/python/test/test_client.py
Outdated
|
||
client = Client(URL) | ||
|
||
assert client.get_descriptor('test.One') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we asserting the value evaluates to True or True equivalent ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
This PR adds the following: