[ckan-dev] ckan-dev Digest, Vol 28, Issue 43
Genhan Chen
genhan.chen at azgs.az.gov
Tue Feb 26 19:17:31 UTC 2013
Thanks for the advice.
I use a shell script to create a temporary database, run nose tests and
drop this temporary database. Hope it can work!
Genhan
On 2/25/2013 5:00 AM, ckan-dev-request at lists.okfn.org wrote:
>> >I believe you can specify the database to use in the .ini file given to
>> >nosetests but the test do not drop/create the database. They will
>> >drop/create tables in the database though. dropping/creating databases
>> >require elevated permissions.
> Right, if you add an sqlalchemy,url setting to test-core.ini, like:
>
> sqlalchemy.url = postgresql://ckanuser:pass@localhost/ckantest
>
> that'll change the database (and user and password) that the ckan tests
> use. 'ckanuser', 'pass' and 'ckantest' can be any postgresql user,
> password and database. Just set it to a different database from the one
> your development or production ini file uses, and then it won't
> overwrite your data when the tests run. (But yes, I think you'll have to
> create the database and user once first, see CKAN's source-install
> instructions for the commands to do this.)
>
> @ckan-devs, I wonder if maybe we should make test-core.ini use a
> different database from the development/production ini file template by
> default? I think it does surprise people when running the tests wipes
> all their data (and it's also annoying).
--
Genhan Chen
Arizona Geological Survey
http://www.azgs.az.gov/
Phone: 520-209-4136
Email: genhan.chen at azgs.az.gov
More information about the ckan-dev
mailing list