Skip to content

Automated Unit Testing

Fraser Harris edited this page Oct 3, 2015 · 10 revisions

Introduction

We use nose.

Debug

  1. Can't create test database
(venv)vagrant@vagrant-ubuntu-trusty-64:/opt/secondfunnel/app$ python manage.py test apps/assets
nosetests apps/assets --verbosity=1
Creating test database for alias 'default'...
Got an error creating the test database: permission denied to create database

Type 'yes' if you would like to try deleting the test database 'test_sfdb', or 'no' to cancel: yes
Destroying old test database 'default'...
Got an error recreating the test database: database "test_sfdb" does not exist

Give the vagrant database user the CREATEDB permission.

postgres@vagrant-ubuntu-trusty-64:/opt/secondfunnel/app$ psql -h localhost
postgres=# ALTER USER sf CREATEDB;
ALTER ROLE
postgres=# \q

Note: if you get a Password: prompt, [[see this about setting a password for postgres user|Database:-Postgres#3-setting-a-postgres-user-password]].

Clone this wiki locally