fastmonkeys / stellar

Fast database snapshot and restore tool for development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make it usable as library (with passed in config)

blueyed opened this issue · comments

I think stellar might be a good option for a (Django) test suite, where you want to rollback to a previous state (including data migrations - Django would flush the tables, but keep the schema migrated).

For this to be usable from the tests (without stellar init and a config file), it would be required to allow for passing in options to Stellar for example.

What do you think about that?
I'd be happy to prepare a PR for this.

commented

Overriding Stellar's __init__ and load_config might do the trick. I will happily merge such PR that makes it any easier to use it without the cmd line app.

I had a stab at this but found that stellar's behaviour of os.fork()ing in order to do the snapshots tripped me up in my use case (also testing, and involving pdb. It resulted in several pdb prompts on the same console (i.e. unusable))
For the time being I've resorted to running stellar through subprocess with a generated stellar.yaml

commented

Oh yeah the os.fork() must be a tricky one.