-
Notifications
You must be signed in to change notification settings - Fork 289
PooCon2016: Testing and debugging Pootle
phlax edited this page Oct 25, 2016
·
12 revisions
- coverage is up to around 93%
- py.test
- high test coverage facilitates rapid dev
- machine linting
- some doctests
-
flake8
- combinedpep8
andpyflakes
pylint
csslint
eslint
isort
- commands:
make lint-python
make lint-css
make lint-js
- travis.com
- coveralls.io
- codecov.io
- landscape.io
- requires.io
- New Relic
- swiss army knife of debugging
- introspect local vars and test code
import pdb; pdb.set_trace()
import inspect; inspect.stack()[10]
- usually the most important part of optimization
- debug lines of django code with
debug_sql
- use the sql in
dbshell
and experimentdescribe select ...
show create table ...
alter table ... add index ...
py.test -vv --debug.tests my-timings.txt
- drill down to time-consuming tests and debug_sql
- common optimizations
- preventing duplicate calls
- adding
select_related
or pre-initializing related objects - prefetching
-
values_list
- sometimes with aProxyAdapter
(alsoQueryset.only()
?)