pygsheets
pygsheets copied to clipboard
Improvement the way and environment of testing
Overall
I will offer some ideas about the way and environment of testing. It will improve developer experiences a lot.
Ideas
- to create a new command in Makefile which enables developers to test each function. Developer must currently test all functions even if they try to implement just one function.
- to make it possible to use the developer's credential instead of using default credential. If they would like to confirm the action of functions in pipeline, they must overwrite pygsheettest_service_account.json by their credential and also overwrite these classes by local spreadsheet. for example.
# @pytest.mark.skip()
class TestWorkSheet(object):
def setup_class(self):
title = test_config.get('Spreadsheet', 'title') + PYTHON_VERSION
self.spreadsheet = pygsheet_client.create(title)
self.worksheet = self.spreadsheet.worksheet()
sp = self.python_client.open_by_key('MY_SPREADSHEET_KEY')
self.worksheet = sp.sheet1 # to overwrite worksheet class by worksheet in myDrive
Any other info
If you feel positve about these ideas, I would like to contribute as much as possible.
Hi @rariyama , these suggestions sound very promising and can improve the developer experience.
-
since we are using pytest, this can be easily achieved by creating a new command in Makefile for calling the pytest command to run specific functions
pytest test_mod.py::test_func
-
I usually test my local changes using manual_testing.py. But you are right, if someone has to run the online tests on their account, it would need some fiddling around in config files. It would be nice to have a simpler documented method to do that.