pygsheets icon indicating copy to clipboard operation
pygsheets copied to clipboard

Improvement the way and environment of testing

Open rariyama opened this issue 3 years ago • 1 comments

Overall

I will offer some ideas about the way and environment of testing. It will improve developer experiences a lot.

Ideas

  1. 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.
  2. 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.

rariyama avatar Jan 29 '22 15:01 rariyama

Hi @rariyama , these suggestions sound very promising and can improve the developer experience.

  1. 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

  2. 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.

nithinmurali avatar Jan 30 '22 20:01 nithinmurali