diff options
Diffstat (limited to 'software/python.page')
-rw-r--r-- | software/python.page | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/software/python.page b/software/python.page index deada7a..0fd2531 100644 --- a/software/python.page +++ b/software/python.page @@ -102,15 +102,21 @@ number (as an int). RunSnakeRun ------------- +Runsnake seems to be unmaintained... `snakeviz` is the new thing? + Example session:: $ python -m cProfile -o ./dump.profile myscript.py --script-option blah $ # run to completion or Ctrl-C, then $ runsnakerun ./dump.profile + # or + $ snakeviz ./dump.profile nosetests ------------- +NOTE: by default I now use pytest instead of nose + To do minimal tests without wrapping everything in a class, import assert functions from nose.tools, eg:: @@ -169,3 +175,33 @@ To make Python 3.4 the default for `python` system-wide, do something like: For an individual user you can also just create a `python` alias. See also: http://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux + + +Nice Packages +-------------- + +subprocess/pexpect: https://github.com/kennethreitz/delegator.py + +time/datetime: https://github.com/crsmithdev/arrow + +tsv: https://github.com/kennethreitz/tablib + +simple HTML scraping: https://github.com/michaelhelmick/lassie + +sqlite3dbm is a library to back a python dict with sqlite3 on disk + + +pytest +----------- + +pytest sort of "just works" if you put test files under `./tests/`. If you want +crude file imports, skipping directories, and including `test_*` functions from +any python file (not just those with `test_*.py`, install `pytest-pythonpath` +and create a `pytest.ini` like: + + [pytest] + python_paths = . + python_files = *.py + norecursedirs = .svn _build tmp* + +Need to mock? <https://blog.fugue.co/2016-02-11-python-mocking-101.html> |