Skip to content

Latest commit

 

History

History
104 lines (67 loc) · 3.05 KB

INSTALL.md

File metadata and controls

104 lines (67 loc) · 3.05 KB

Clone socorro-crashstats

git clone https://github.com/mozilla/socorro-crashstats
cd socorro-crashstats

Clone vendor repositories

git submodule update --init --recursive

Add the LESS Preprocessor

You need to install less and make sure it's available on your PATH.

Create virtualenv and populate it

virtualenv --python=python2.6 .virtualenv
source .virtualenv/bin/activate
pip install -r requirements/compiled.txt
pip install -r requirements/dev.txt

Copy default config file and customize it

cp crashstats/settings/local.py-dist crashstats/settings/local.py

Run unit tests

Before running the tests, you will have to make sure your configuration has the CACHES key set to use LocMemCache as a backend. See crashstats/settings/local.py-dist for a working example. Then you will need to compress static files, using the following:

./manage.py collectstatic --noinput && ./manage.py compress_jingo --force

First running collectstatic and compress_jingo is more realistic compared to how the production server is run. Also, it's faster. If you want to disable static file compression you can add COMPRESS_OFFLINE = False to your settings/local.py.

To run a specific test file, use for example:

./manage.py test crashstats/crashstats/tests/test_views.py

And to run a specific testcase, use for example:

./manage.py test crashstats/crashstats/tests/test_views.py:TestViews

And lastly, to run a specific test, use for example:

./manage.py test crashstats/crashstats/tests/test_views.py:TestViews.test_plot_signature

Run the dev server, by default will listen on http://localhost:8000

./manage.py runserver

How to pretend you're Jenkins running the tests

If jenkins is failing and you might want to debug it locally to try to find out what's going on. Then follow these steps:

  1. cd /tmp
  2. git clone git://github.com/mozilla/socorro-crashstats.git
  3. WORKSPACE=/tmp/socorro-crashstats ./bin/jenkins.sh

It will take care of creating and using a virtualenv for you.

How to run coverage tests

There are more options available if you run ./manage.py test --help but this is the basic command to run coverage tests on the crashstats package:

./manage.py test --cover-erase --with-coverage \
--cover-package=crashstats --cover-html

That'll create ./cover/index.html for your viewing pleasures.

Enable your pre-commit hook

Paste this into .git/hooks/pre-commit:

check.py | grep "\s" | grep -v 'unable to detect undefined names'
if [ "$?" -ne "1" ]
then
    echo "Aborting commit.  Fix above errors or do 'git commit --no-verify'."
    exit 1
fi

Then, make the file executable:

chmod +x .git/hooks/pre-commit