<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dragffy.com &#187; Django</title>
	<atom:link href="http://dragffy.com/blog/posts/category/programming/frameworks/django-frameworks-programming/feed" rel="self" type="application/rss+xml" />
	<link>http://dragffy.com/blog</link>
	<description>The development, documentation, and blogging domain of Gabriel Dragffy.</description>
	<lastBuildDate>Wed, 27 Jan 2010 14:23:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Python Doctests in Django with fixtures</title>
		<link>http://dragffy.com/blog/posts/using-python-doctests-in-django-with-fixtures</link>
		<comments>http://dragffy.com/blog/posts/using-python-doctests-in-django-with-fixtures#comments</comments>
		<pubDate>Tue, 24 Jun 2008 15:28:51 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=61</guid>
		<description><![CDATA[Django is a pretty decent web framework for Python. Having brushed up on my Python programming I started to fall in love with doctests. I then went ahead and wrote about 100 lines of doctest for model in Django, then found all tests were failing because the database fixtures weren&#8217;t being loaded.
I couldn&#8217;t find out [...]]]></description>
			<content:encoded><![CDATA[<p>Django is a pretty decent web framework for Python. Having brushed up on my Python programming I started to fall in love with doctests. I then went ahead and wrote about 100 lines of doctest for model in Django, then found all tests were failing because the database fixtures weren&#8217;t being loaded.</p>
<p>I couldn&#8217;t find out how to install fixtures inside doctests from the official documentation, I did however, come across what seemed like a web page written in Japanese. I had to skip the Japanese but figured out the code samples. Getting fixtures working with doctests in django is fairly simple &#8211; once you know how!</p>
<p>At the top of your doctest you will need the following two lines:<br />
<code>>>> from django.core import management<br />
>>> management.call_command("loaddata", "project/fixtures/test.json", \<br />
        verbosity=0)</code></p>
<p>Replace <code>project</code> and <code>test.json</code> with your project name and fixture. Then continue with the doctests as per usual. After they are done put the following line at the end of the doctest:<br />
<code>>>> management.call_command("flush", verbosity=0, interactive=False)</code></p>
<p>That should be just about it <img src='http://dragffy.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/using-python-doctests-in-django-with-fixtures/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
