Skip to content
Jeff Tratner edited this page Jun 29, 2013 · 10 revisions

Python

Testing for versions

In [1]: from distutils.version import LooseVersion
In [2]: LooseVersion(np.__version__)>='1.7.0'
Out[2]: True

Skipping an entire file full of tests on a failed import of a module named a_module

import nose

try:
    import a_module
except ImportError:
    raise nose.SkipTest

Git

add the pandas remote repository to your fork and name it upstream

git remote add upstream git://github.com/pydata/pandas

pull in the latest upstream changes without merging

git fetch upstream

fetch changes from upstream and rebase off of latest upstream/master changes

git fetch upstream
git rebase upstream/master

fetch and then rebase interactively to squash, reword, fix, otherwise change some commits

git fetch upstream
git rebase --interactive upstream/master

This tip allows you to rebase relative to upstream/master which allows you to do squash commits from the point at which your fork diverged from pandas upstream

Nose

Exclude a particular test (e.g., a test that's failing you don't care about)

nosetests -Isome_test_name

Fail fast (on first failure - useful with git bisect)

nosetests -x

Run with ids (and just re-run tests that failed)

# stores ids
nosetests --with-ids
# runs only tests that previously failed 
nosetests --failed
Clone this wiki locally