Skip to content

KjellSchubert/python-playground

Repository files navigation

(Personal Python cheat sheet)

To install deps same way as travis-ci and heroku, equivalent to npm install packacke.json:

  pip install virtualenv
  virtualenv venv
  pip install -r requirements.txt --upgrade

To run all unit tests:

  python -m unittest discover -s tests

P.S.: switched to nosetest since this seems more comfortable to use:

  pip install nose
  nosetests

PyDev: requires Java 1.7 in Eclipse Luna, silently fails with 1.6. Can run nosetests in graphical debugger.

To run a single unit test:

  python -m unittest tests.test_koa.KoaAppTestCase.test_koa_router_http_post
  nosetests tests/test_admin_app.py:AdminAppTestCase.test_GET_conditionPropertyValues

To stop at a breakpoint in nose just add -s (see here). When using 'python -m unittest' no additional options are needed to hit break points.

  nosetests -s tests/test_admin_app.py:AdminAppTestCase.test_GET_conditionPropertyValues

PDB cmd docu is here

To get cov for unit tests (see also .travis.yml for how to run):

  pip install coverage
  coverage run -m unittest discover -s tests
  coverage report -m

To replace mixedCase with Python-preferred case:

  sed -i -e :loop -re "s/(^|[^A-Za-z_])([a-z0-9_]+)([A-Z])([A-Za-z0-9_]*)([^A-Za-z0-9_]|$)/\1\2_\l\3\4\5/" -e "t loop" foo.py

C10k - capable Python servers are:

About

personal python notes & cheat sheet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors