Monday, March 17, 2014

Basketball Science

Patterns, abstraction and applying IT to basketball.

Crossing two things I love.


Wednesday, February 12, 2014

Rerunning only failed tests with nosetests

When it comes to maintaing hundreds of tests this comes in really handy:

python manage.py test --failed

This will only rerun failed tests,

to use it you need to use the nosetests runner and have nose-exclude installed.

See this article for details:

http://webamused.wordpress.com/2010/04/07/tutorial-testing-efficiently-with-nose-nose-exclude-and-django-nose/



Thursday, October 24, 2013

What I didn't know about nodemon

So I was looking for inotifywait alternatives for mac, and found that what I was already using for node.js can be used for any extension.

I want to watch a directory of .tex files for changes and compile the Latex document when changed.

nodemon -x "pdflatex document" -w ./ -e .tex

more generally

nodemon -x "<command>" -w <dirtowatch> -e .<extension to watch>

nodemon -h

Tuesday, September 10, 2013

Automatic restart of node.js server on code change

Found this gem:

 https://github.com/remy/nodemon

 usage simple as:

 nodemon server.coffee

Thursday, June 20, 2013

First Post: Overriding Django DEBUG setting for unit tests

I have found a line of code so nice, that I decided to make a blog for it.

Problem: Running selenium tests with django using django-selenium  test runner. As you might know this runs a test server for your selenium tests the same way good old fashioned django unit tests does it.
If you get a 500 it is really hard to debug ot having access to that instance of the server also DEBUG is set to False by Django for tests.

Solution: It is possible to really easily override where necessary:


from django.test.utils import override_settings
from django.conf import settings
class TestSomething(TestCase):
    @override_settings(DEBUG=True)
    def test_debug(self):
        assert settings.DEBUG

source: 

http://stackoverflow.com/questions/7447134/how-do-you-set-debug-to-true-when-running-a-django-test