- Tim Golden: Ten Things Coming in Python 3.4
- David Winterbottom: A Smorgasbord of Testing
- The Test People: Breaking Things for Money
- Rob Collins: Test-Driven Madness
For more PyCon UK follow-up goodness, check out the conference wiki.
from nose.tools import assert_equal # pylint: disable=E0611Problem solved! Your pylint run will no longer flag this line up as problematic. There are a few issues with disabling checks, though. Firstly, you have to remember to do it. Secondly, it crufts up the screen when you're trying to read, and gives you more information that you need to process. Finally, and often most crucially, you can accidentally change the scope of your disabling. Consider the following lines at the top of a module:
# pylint: disable=E0611 from nose.tools import assert_equal, assert_items_equal, assert_greaterThis does solves the warning (and avoids violating PEP-8's line limit), but it has an unintentional consequence: E0611 is now disabled for the entire file. pylint will no longer catch this obvious error!
# pylint: disable=E0611 from nose.tools import assert_equal, assert_items_equal, assert_greater from mcok import Mock
from nose import tools function_template = """ def {}(*args, **kwargs): pass """ def nose_transform(module): funcs = ''.join(function_template.format(func_name) for func_name in tools.__all__) fake = ASTNGBuilder(MANAGER).string_build(funcs) for func_name in tools.__all__: if func_name not in module.locals: module.locals[func_name] = fake[func_name]Just follow the installation instructions in the gist, and all of your pylint nose.tools problems will disappear!
Dear Kate Hoey,
You may recently have read in The Guardian about Sports Direct's policy of keeping all of their part-time employees on zero-hour contracts[1].
I feel like zero-hour contracts are unacceptable, as they leave employees with no sick pay, holiday pay or guarantee of future earnings. This sort of security is something that I feel an employer should provide their employees with.
I would appreciate hearing your thoughts on this matter which I consider very important.
Yours sincerely
Daniel Watkins
[1] http://m.guardian.co.uk/business/2013/jul/28/sports-direct-staff-zero-hour-contracts
I would like a test runner that detects when I have changed tests/code, and runs the relevant tests.I haven't quite come up with that (though I do now have a half-finished blog post prognosticating on it), but I do have a solution which covers some of the bases: I determine what tests I want to run, and the test harness runs them whenever my code changes.
— Daniel Watkins (@Odd_Bloke) January 31, 2013
while inotifywait -e close_write -r $CODE_DIRS --exclude=".*sw[px]"; do $TEST_COMMAND doneThis while loop is simple. When the inotifywait command stops blocking (and with exit code 0, which it will unless something unusual has happened to the files you're watching), we run $TEST_COMMAND. You can put whatever you want there, so you could limit the number of tests you run that way.
file or directory closed, after being opened in writable modevim triggers this when I save, so it works for me. You might also want to listen for modify (file or directory contents were written), move (file or directory moved to or from watched directory) and create (file or directory created within watched directory). Multiple -e options are comma-separated.
git diff "HEAD@{1}"will show you the diff between what you currently have in your tree and the commit before the last action that changed your history. Importantly, it treats merges as a single entry, so if you are immediately post merge, running the above command will show you a diff containing everything that changed in that merge, regardless of the number of commits the merge contained.
#!/bin/bash set -eu git diff "HEAD@{1}" --name-only | grep config/development.conf 2>&1 > /dev/null CHANGED=$? if [ $CHANGED ]; then echo echo -e "\e[41m!!! development.conf HAS CHANGED !!!\033[0m" echo echo "You should reload config using (something like):" echo " ./manage.py loadconfig config/development.conf" fiWe check if anything has changed, and if it has then we print out a BRIGHT RED WARNING MESSAGE. Drop that in .git/hooks/post-merge, make it executable, and you're good to go.
#!/bin/bash find $(git rev-parse --show-cdup) -name "*.pyc" -delete