Tuesday, April 24, 2012

#Django District @jackiekazil talking about Testing at #Pycon

Persistent themes from PyCon:

Mocking - Looks to be heading to be part of the main Python library.

System Resources:

Python Profiler only shows CPU time.
Use Unix Time Command to look at wall clock and CPU time then subtract for idea of I/O Time.

Pull out methods in to free functions

Factor out parts that don't touch attributes into a separate free function

Maintainable Testing:

- Design with testing in mind.

- Don't write tests to write tests. 

Mocking:

Mimic behavior of real objects in controlled ways.

Check out a great PyCon talk on Large Scale Testing

Don't Test Django - Write tests for your apps.

Use __init__.py to import all sub modules.
Don't hit the DB.

Don't run tests that do a self.save.

NOSE can re-order tests to optimize fixture loading

Posted via email from ekivemark: pre-blogspot