git clone https://github.com/mozilla/socorro-crashstats
cd socorro-crashstats
git submodule update --init --recursive
You need to install less and
make sure it's available on your PATH
.
virtualenv --python=python2.6 .virtualenv
source .virtualenv/bin/activate
pip install -r requirements/compiled.txt
pip install -r requirements/dev.txt
cp crashstats/settings/local.py-dist crashstats/settings/local.py
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
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:
cd /tmp
git clone git://github.com/mozilla/socorro-crashstats.git
WORKSPACE=/tmp/socorro-crashstats ./bin/jenkins.sh
It will take care of creating and using a virtualenv for you.
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.
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