For Developpers

Write tests

Client-side extension

The client-side extension uses Mercurial’s own test framework to be tested. This means that mercurial has to be present as a source package for tests to be run.

The recommended setup is to clone mercurial repository next to the buglink one.

Then To run the tests, simply run:

$ make tests

within the buglink root directory (probably buglink). If you added some, and want to update the corresponding output, call the tests as follow:

$ make tests TESTFLAGS=-i

This way, you will be asked if the given output match your expectations, and if you want to include it in the test-case.

Server-side extension

Database migration

database migration, using sqlalchemy-migrate can be tested with their own tools, just run:

migrate test sqlite:////path/to/db .

in the server/dbmigrate directory. (Don’t forget to run it only on test-databases).

Mercurial hook

Todo

Write tests

Web Server

Unit-tests

Some parts of the web-server can be independently tested. In those cases, write teste into the tests/server directory.

To run those tests use the following command line in the buglink directory:

$ PYTHONPATH=. python tests/server/runtests.py

Flask-tests

Todo

Write flask tests as described under http://flask.pocoo.org/docs/testing/.

Upgrade the DB Schema

The DB is versionned, which means that each upgrade should follow a specific procedure. This one is described there.

  1. Write a new script under server/dbmigrate/versions
  2. Test the upgrade procedure with sqlalchemy-migrate
  3. Upgrade the DB model version and (maybe) dscription in server/models.py.
  4. Optionnaly integrate your change in the view.

A tentative is made to keep the schema decribed in the following figure:

DB schema

Database schema version 5