Closed GochoMugo closed 9 years ago
Good idea. Or to simplify this, we can search for the .credential file first (actually, why not just call test_settings.py? With this user can also specify the db host and username, dbname, etc). If the file is not found, use the default settings (as in the test script now). Setting environment variables is less easy. What do you think?
I now understand we need more configuration values apart from the username and password. Is using a python script file the best option in defining such values? I would suggest yaml
I suggest using environment variables as we prepare to add continuous integration such as Travis CI. This will allow tweaking only environment variables without touching the test script itself, in cases such as moving from a one CI service to another.
Huh...Interesting. I haven't used Travis CI before, but sounds a good idea.
I'll try to restructure the test script today. This piece of code will be published to the develop branch
I got the test scripts restructured. I use a yml file as the config file. It should be easier to test locally now.
There is an issue with running these tests. The username and password are hard-coded into the test script. This means that if anyone wants to run the tests, they would have do one of the following:
None of this is easy considering changing the test script would mean entirely different changes among collaborators. Also creating a user may not be possible, say on a CI server.
I suggest we use this approach: allow user running the test to create a credentials file, say named .credentials.yml that will be holds the username and password and that will be added to .gitignore to avoid checking it into git. If the user does not have such a file, particularly CI servers, we try use environment variables instead.