#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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s