Skip to content
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

Proposal for a simplified data store API #93

Closed
surajbarkale opened this issue Jul 17, 2018 · 6 comments
Closed

Proposal for a simplified data store API #93

surajbarkale opened this issue Jul 17, 2018 · 6 comments

Comments

@surajbarkale
Copy link
Contributor

Description

The current data store API seems to be inspired by Java and does not feel very pythonic. A simple dict access would better suit python code.

Implementation in getgauge/python.py can be:

class DataStoreContainer:
    def __init__(self):
        self.__scenario = dict()
        self.__spec = dict()
        self.__suit = dict()

    @property
    def scenario(self):
        return self.__scenario

    @property
    def spec(self):
        return self.__spec

    @property
    def suit(self):
        return self.__suit


data_store = DataStoreContainer()

It can be used in step as follows:

from getgauge import step, data_store

@step("description")
def step_fn():
	value = data_store.scenario['key']

This API can also be made backwards compatible through existing DataStoreFactory interface.

@sriv
Copy link
Member

sriv commented Jul 17, 2018

Hi @surajbarkale - thank you for the suggestion. This looks neat.

Would you like to send us a Pull Request?

@surajbarkale
Copy link
Contributor Author

I shall try to create one

BugDiver pushed a commit that referenced this issue Jul 19, 2018
* Add dictionary based data store

* Allow attribute acces to data store

* Revert changes to skel to submit as seperate PR

* Add deprecation warnings for existing data store API
@BugDiver
Copy link
Member

This issue still needs testing.

@BugDiver BugDiver reopened this Jul 19, 2018
@BugDiver
Copy link
Member

The fix Should be available in nightly >= 19 July 2018

@sswaroopgupta
Copy link
Contributor

Documentation should be updated with the recommended usage.

@BugDiver
Copy link
Member

The documentation is already updated. Refer getgauge/docs.gauge.org#85

@ghost ghost removed the ready for QA label Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants