<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Lain and Sakura</title>
	<atom:link href="http://ekisip.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ekisip.wordpress.com</link>
	<description>''One byte to rule them all' - dtmf - old school</description>
	<lastBuildDate>Mon, 04 May 2009 18:53:41 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>es</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ekisip.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/c6be713912c9d26fb7ace192bfc1d335?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Lain and Sakura</title>
		<link>http://ekisip.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ekisip.wordpress.com/osd.xml" title="Lain and Sakura" />
		<item>
		<title>Eagle Mode en Ubuntu Jaunty Jackalope 9.04</title>
		<link>http://ekisip.wordpress.com/2009/05/04/eagle-mode-en-ubuntu-jaunty-jackalope-904/</link>
		<comments>http://ekisip.wordpress.com/2009/05/04/eagle-mode-en-ubuntu-jaunty-jackalope-904/#comments</comments>
		<pubDate>Mon, 04 May 2009 18:53:41 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=51</guid>
		<description><![CDATA[Le heche un vistazo y esta muy bueno, sobre todo el ajedrez hehe.
Para instalarlo en ubuntu y evitar errores de compilacion, los pasos serian los siguientes:
En mi caso lo prefiero tener en un directorio oculto, por lo tanto
sakura@sakura-laptop: mkdir ~/.eaglemode
Luego ingreso al directorio
sakura@sakura-laptop: cd ~/.eaglemode
Descargo el fuente y lo &#8216;descomprimo&#8217;
sakura@sakura-laptop: wget http://downloads.sourceforge.net/eaglemode/eaglemode-0.75.0.tar.bz2 ; tar jxvf [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=51&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Le heche un vistazo y esta muy bueno, sobre todo el ajedrez hehe.</p>
<p>Para instalarlo en ubuntu y evitar errores de compilacion, los pasos serian los siguientes:</p>
<p>En mi caso lo prefiero tener en un directorio oculto, por lo tanto</p>
<p><strong>sakura@sakura-laptop:</strong><strong> mkdir ~/.eaglemode</strong></p>
<p>Luego ingreso al directorio</p>
<p><strong>sakura@sakura-laptop:</strong><strong> </strong><strong>cd ~/.eaglemode</strong></p>
<p>Descargo el fuente y lo &#8216;descomprimo&#8217;</p>
<p><strong>sakura@sakura-laptop:</strong><strong> </strong><strong>wget http://downloads.sourceforge.net/eaglemode/eaglemode-0.75.0.tar.bz2 ; tar jxvf eaglemode-0.75.0.tar.bz2</strong></p>
<p>Renombo el directorio<strong>, </strong>esto es por gusto mio propio, no influye en que ande o n<strong>o</strong> e ingreso al nuevo directorio renombrado.</p>
<p><strong>sakura@sakura-laptop:</strong><strong> </strong><strong>mv eaglemode-0.75 src; cd src</strong></p>
<p>Ahora instalamos estas librerias para que no falle en la compilacion:</p>
<p><strong>sakura@sakura-laptop:</strong><strong> </strong><strong>sudo apt-get install libx11-dev libxine-dev libtiff4-dev</strong></p>
<p>Terminada la instalacion de esas libreriass, pues compilamos el src como dice en su doc:</p>
<p><strong>sakura@sakura-laptop:</strong><strong> </strong><strong>perl make.pl build</strong></p>
<p>terminada la compilacion, podremos ejecutar eagle de esta forma:</p>
<p><strong>sakura@sakura-laptop:</strong><strong> </strong><strong>./eaglemode-sh</strong></p>
<p>y listo, espero les guste! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Muy recomendable leer las recomendaciones del sistema, puesto que no es para correr en maquinas con bajos recursos:</p>
<p>http://eaglemode.sourceforge.net/SystemRequirements.html</p>
<p>En mi caso lo corri satisfactoriamente en una inspiron 1521 con un turion tl-60 dual core 2ghz por core y 1.5 de ram con una tarjeta ati 1250 (pero sin usar aceleracion 3d, puesto que eagle no lo precisa).</p>
<p>Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=51&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2009/05/04/eagle-mode-en-ubuntu-jaunty-jackalope-904/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>
	</item>
		<item>
		<title>Primer Clase</title>
		<link>http://ekisip.wordpress.com/2009/04/01/primer-clase/</link>
		<comments>http://ekisip.wordpress.com/2009/04/01/primer-clase/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 00:35:08 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[C With Guido Style]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=49</guid>
		<description><![CDATA[Funciones E/O
El kernel manda una cadena entera y luego
getchar comienza a iterar char by char.
Esto es para ahorrar recursos
getchar()
Empezamos a definir mas tipos de datos.
C tiene tipos PRIMITIVOS
(int, char, etc)
Permite fabricar tipos nuevos (tipos derivados),
uno de ellos es el ARREGLO que esta formado por
n valores de un mismo tipo contiguos en memoria.
Veamos que significa esto:
Ej:
int [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=49&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Funciones E/O<br />
El kernel manda una cadena entera y luego<br />
getchar comienza a iterar char by char.<br />
Esto es para ahorrar recursos<br />
getchar()</p>
<p>Empezamos a definir mas tipos de datos.<br />
C tiene tipos PRIMITIVOS<br />
(int, char, etc)</p>
<p>Permite fabricar tipos nuevos (tipos derivados),<br />
uno de ellos es el ARREGLO que esta formado por<br />
n valores de un mismo tipo contiguos en memoria.</p>
<p>Veamos que significa esto:</p>
<p>Ej:<br />
int a; /* es un entero */<br />
int a[5]; /* es un arreglo de 5 caracteres */</p>
<p>en memoria:</p>
<p>4 bytes<br />
|    |    |    |    |    |    |<br />
int    int    int    int</p>
<p>Cada entero ocupa 4 bytes.</p>
<p>Se puede acceder a cada entero individualmente ?<br />
SI<br />
|    |    |    |    |    |    |<br />
a[0]    a[1]    a[2]    a[3]    a[4]    a[5]    a[6]</p>
<p>Cantidad es:<br />
Ej:<br />
int a[5];<br />
comienza de a[0]<br />
cantidad a[5] &#8211; 1 /* porque comienza de 0 */</p>
<p>Por supuesto, se puede hacer arreglos con cualquier cosa ya definida.</p>
<p>Nota en C:<br />
/* en java se puede declarar int [5] a; */<br />
Esto en C es un ERROR</p>
<p>Tambien se puede escribir:</p>
<p>int a[5]; b;<br />
el tipo se &#8216;pega&#8217; al identificador, no al tipo.</p>
<ol>
<li>###########################################################</li>
</ol>
<p>Variables automaticas globales y estaticas.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<ul>
<li>Una variable es automatica cuando esta declarada dentro de un</li>
</ul>
<p>bloque de codigo. Solo es visible dentro de ese bloque.<br />
Tiene una pequenia excepcion: Los parametros de una funcion,<br />
que son visibles dentro del bloque de esa funcion.<br />
C garantiza (contrato firmado) que una variable automatica tendra<br />
cualquier cosa hasta la primera asignacion.</p>
<p>int a;<br />
/* no se puede hacer ninguna suposicion sobre lo que<br />
hay en a en este momento hasta que no se realiza una<br />
asignacion. Sistemas UNIX llenan de 0 la mem. */</p>
<p>a = getchar()<br />
/* ya tenemos una asignacion */</p>
<ul>
<li>Una variable es GLOBAL si esta declarada fuera de cualquier</li>
</ul>
<p>bloque.<br />
Ej:</p>
<p>int i; /* var global */</p>
<p>int main(){<br />
int i; /* var local, que encima pisa a la global */<br />
}</p>
<p>Es visible desde su declaracion.<br />
C GARANTIZA que su valor inicial sera cero, excepto que se le asigne<br />
algo.<br />
Ej:<br />
int j; /* j va a venir en 0 */<br />
int k = 3; /* k viene en 3 */<br />
int h[3]; /* todos los valores del arreglo vienen en 0 */</p>
<p>Tiempos de vida.<br />
- Una automatica se crea con el bloque que la contiene. (el bloque<br />
se activa). Cuando se inicia el bloque, se inician las variables<br />
locales a ese bloque)</p>
<p>Ej:<br />
int main(){<br />
int a;<br />
int b;<br />
int c; /* se inicializa al arrancar main, no importa el orden */<br />
}</p>
<p>- Una global &#8216;vive&#8217; todo el tiempo que &#8216;vive&#8217; el proceso, como los<br />
dinosaurios de susana gimenez. (chiste de guido).</p>
<p>Existe una categoria intermedia, las variables estaticas. Son locales<br />
(se definen dentro de un bloque y son visibles solo dentro del bloque),<br />
pero duran &#8217;siempre&#8217;, durante el tiempo de vida del proces como las<br />
globales. Como se declaran ?<br />
Ej:<br />
int main(){<br />
int i; /* es automatica, cuando termine main fue */<br />
static int j; /* es intermedia */<br />
}</p>
<p>Es una variable que retiene valores aunque su bloque no este activo.<br />
Ej: hacer una funcion que diga cuantas veces fue llamada anteriormente.<br />
sin usar variables globales. hacer una funcion que diga cuantas veces fue llamada anteriormente.</p>
<p>VER ex2.c<br />
VER ex3.c</p>
<ol>
<li>#####################################################</li>
</ol>
<p>Delicias de ++ y &#8211;, junto a un error de Java<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
a++ usa el valor de a y lo incrementa luego. &#8216;Luego&#8217; es<br />
antes de la sentencia siguiente, en cualquier momento,<br />
cuando se deja librado al compilador.</p>
<p>++a es Incremente y Use.</p>
<p>a&#8211; y &#8211;a, igual pero decrementa.</p>
<p>Esto significa que si tenemos una funcion f que toma<br />
tres enteros,<br />
int i=1;<br />
f(i++, i++, i++);</p>
<p>f puede recibir segun el compilador 1, 1, 1 o 1, 1, 2 o 1, 2, 3,<br />
en otras palabras, no hacer esto!</p>
<p>Ejercicios:</p>
<p>ex2.c</p>
<blockquote>
<ol>
<li>include &lt;stdio.h&gt;</li>
</ol>
<p>int cuantas_veces_me_llamaron(){<br />
int i = 0;<br />
return ++i;</p>
<p>} /* esto no funca porque siempre se inicializa<br />
a 0 i, por eso la ponemos estatica */</p>
<p>int working_cuantas_veces_me_llamaron(){<br />
static int i = 0;<br />
return ++i;<br />
}</p>
<p>int main(){</p>
<p>int i;<br />
for(i=0; i&lt;=1000; i++)<br />
printf(&#8220;%d \n&#8221;, working_cuantas_veces_me_llamaron());</p>
<p>return 0;<br />
}</p></blockquote>
<p>ex3.c</p>
<blockquote><p>#include &lt;stdio.h&gt;</p>
<p>int main(){</p>
<p>int i;<br />
for(i=0; i&lt;10; i++){</p>
<p>int j=5; /* cada vez que se ejecuta el for,<br />
j es creada */<br />
static int k = 5; /* static, lero lero */</p>
<p>printf(&#8220;%d\t %d \n&#8221;, j, k);<br />
j++; k++;</p>
<p>}<br />
return 0;<br />
}</p></blockquote>
<p>ex4.c</p>
<blockquote><p>#include &lt;stdio.h&gt;</p>
<p>int main(){<br />
int i=10;<br />
i += i++;<br />
printf(&#8220;%d\n&#8221;, i);<br />
return 0;<br />
/* esto devuelve 21 en C, en java<br />
devuelve 20 */<br />
}</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=49&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2009/04/01/primer-clase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>
	</item>
		<item>
		<title>Functional tests &#8211; Windmill impresionante!</title>
		<link>http://ekisip.wordpress.com/2008/11/21/functional-tests-windmillbook-impresionante/</link>
		<comments>http://ekisip.wordpress.com/2008/11/21/functional-tests-windmillbook-impresionante/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 14:51:24 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=45</guid>
		<description><![CDATA[

Mission

Windmill is a web testing framework intended for complete automation of user interface testing, with strong test debugging capabilities.
The first goal of Windmill is to make test writing easier, portable and sustainable. Test writing and debugging is an interactive process and requires an architecture that allows for large amounts of flexibility and back-and-forth communication.
The second [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=45&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><blockquote></blockquote>
<blockquote>
<h2>Mission</h2>
<div class="post-info"></div>
<p>Windmill is a web testing framework intended for complete automation of user interface testing, with strong test debugging capabilities.</p>
<p>The first goal of Windmill is to make test writing easier, portable and sustainable. Test writing and debugging is an interactive process and requires an architecture that allows for large amounts of flexibility and back-and-forth communication.</p>
<p>The second goal of Windmill is to keep the project open and transparent, encouraging as much outside contribution as possible. This goal is shared by every project started at OSAF and we have maintained a reputation of accomplishing transparency in Windmill.</p></blockquote>
<p>Extraido de : http://www.getwindmill.com/about</p>
<p>Es un framework que nos permite realizar tests funcionales al estilo selenium de una forma muy sencilla. Tiene algunas particularidades a tener en cuenta, y aun no lo he visto con detalle, pero al menos quiero documentarlo aqui para no olvidarlo y para que quede a disposicion de quienes les pueda ser de utilidad.</p>
<p>Nota: Estoy trabajando sobre Ubuntu Intrepid a 64bits (aclaro por temas de paths, etc &#8230;).</p>
<p>Mi meta es utilizar WindmillBook para testear los proyectos en los que trabajo con plone y zope, utilizo buildouts asi que en mi buildout.cfg agrego lo siguiente :</p>
<blockquote>
<p>[buildout]<br />
parts =<br />
plone<br />
zope2<br />
productdistros<br />
instance<br />
zopepy<br />
windmill<br />
python<br />
pythonbin</p></blockquote>
<p>En donde las secciones windmill, python y pythonbin son :</p>
<blockquote>
<p>[windmill]<br />
recipe=zc.recipe.egg<br />
eggs =<br />
simplejson &lt;=2.0.0dev<br />
windmill</p>
<p>[python]<br />
recipe = zc.recipe.cmmi<br />
url = http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz<br />
executable = ${buildout:directory}/parts/python/bin/python2.5<br />
extra_options=<br />
&#8211;enable-unicode=ucs4<br />
&#8211;with-threads<br />
&#8211;with-readline</p>
<p>[pythonbin]<br />
recipe = plone.recipe.command<br />
command = ln -s ${python:executable} ${buildout:bin-directory}/python</p></blockquote>
<p>Corremos nuevamente nuestro buildout:</p>
<blockquote>
<p>x-ip@x-ip-lain:~/workspace/gibeta$ ./bin/buildout -vN</p></blockquote>
<p>Y estamos listos! Ahora detalle, como trabajo con zope y preciso python2.4, y windmill precisa una version particular de python2.5 (el por ello que utilizamos un recipe en nuestro buildout para tener un python2.5) lo ejecutamos de esta forma :</p>
<blockquote>
<p>x-ip@x-ip-lain:~/workspace/gibeta$ ./bin/python<br />
<strong>Python 2.5.2 </strong>(r252:60911, Nov 20 2008, 16:48:26)<br />
[GCC 4.3.2] on linux2<br />
Type &#8220;help&#8221;, &#8220;copyright&#8221;, &#8220;credits&#8221; or &#8220;license&#8221; for more information.<br />
&gt;&gt;&gt;<br />
<strong>x-ip@x-ip-lain:~/workspace/gibeta$ ./bin/python ./bin/windmill</strong><br />
windmill web test automation system.<br />
windmill [-cdelptmxs] action [option=value] [firefox|ie|safari] [http://www.example.com]</p>
<p>Available Actions:<br />
shell         Enter the windmilll shell environment (modified python shell).<br />
Uses ipython if installed. Exit using ^d<br />
run_service   Run the windmill service in foreground. Kill using ^c.</p>
<p>Available Options:<br />
browserdebug :: Enable browser debugging.<br />
Python tests will all load in to the server at once. Defaults to False<br />
-c, continueonfailure :: Keep the browser running tests after failure. Defaults to False<br />
-d, debug :: Turn on debugging.<br />
-e, exit :: Exit after all tests have run. Defaults to False<br />
extensions= :: The directory containing any windmill javascript extensions.<br />
firebug :: Install Full Firebug. Firefox only!<br />
jsdir= :: JavaScript Test Framework :<br />
Root directory of JavaScript tests.<br />
jsfilter= :: JavaScript Test Framework :<br />
Filter tests, example; ns:test_login,tests:test_user.<br />
jsphase= :: JavaScript Test Framework :<br />
Specify the phases the framework should run example; setup,test,teardown<br />
-l, loadtest= :: Run the given test file/dir<br />
loglevel= :: Log level command, sets the global logging level.<br />
nocompress :: Do not compress windmill javascript files. Defaults to True<br />
-p, pdb :: Enable pdb debugging when running python tests. Defaults to False<br />
port= :: Set port for windmill to run. Default is 4444.<br />
-t, test= :: Run the given test file/dir<br />
-m, firefox :: Start the firefox browser. Defaults to False<br />
-x, ie :: Start the internet explorer browser. Windows Only. Defaults to False<br />
-s, safari :: Start the Safari browser. Mac Only. Defaults to False<br />
usecode :: Use the code module rather than ipython. Defaults to False<br />
x-ip@x-ip-lain:~/workspace/gibeta$</p></blockquote>
<p>Si no lo hacemos, y se ejecuta con un python2.4 nos va a dar este error &#8230;</p>
<blockquote><p>
x-ip@x-ip-lain:~/workspace/gibeta$ ./bin/windmill shell google.com<br />
google.com is not a windmill argument. Sticking in functest registry.<br />
Traceback (most recent call last):<br />
  File &#8220;./bin/windmill&#8221;, line 19, in ?<br />
    windmill.bin.windmill_bin.main()<br />
  File &#8220;/home/x-ip/Trabajo/Rcom/Instancias/gibeta/trunk/eggs/windmill-0.9.1-py2.4.egg/windmill/bin/windmill_bin.py&#8221;, line 52, in main<br />
    admin_lib.command_line_startup()<br />
  File &#8220;/home/x-ip/Trabajo/Rcom/Instancias/gibeta/trunk/eggs/windmill-0.9.1-py2.4.egg/windmill/bin/admin_lib.py&#8221;, line 329, in command_line_startup<br />
    shell_objects = setup()<br />
  File &#8220;/home/x-ip/Trabajo/Rcom/Instancias/gibeta/trunk/eggs/windmill-0.9.1-py2.4.egg/windmill/bin/admin_lib.py&#8221;, line 134, in setup<br />
    httpd, httpd_thread, console_log_handler = run_threaded(windmill.settings['CONSOLE_LOG_LEVEL'])<br />
  File &#8220;/home/x-ip/Trabajo/Rcom/Instancias/gibeta/trunk/eggs/windmill-0.9.1-py2.4.egg/windmill/bin/admin_lib.py&#8221;, line 95, in run_threaded<br />
    httpd, console_handler = setup_servers(console_level)<br />
  File &#8220;/home/x-ip/Trabajo/Rcom/Instancias/gibeta/trunk/eggs/windmill-0.9.1-py2.4.egg/windmill/bin/admin_lib.py&#8221;, line 89, in setup_servers<br />
    httpd = windmill.server.wsgi.make_windmill_server()<br />
  File &#8220;/home/x-ip/Trabajo/Rcom/Instancias/gibeta/trunk/eggs/windmill-0.9.1-py2.4.egg/windmill/server/wsgi.py&#8221;, line 189, in make_windmill_server<br />
    windmill_xmlrpc_app =  wsgi_xmlrpc.WSGIXMLRPCApplication(instance=xmlrpc_methods_instance)<br />
  File &#8220;/home/x-ip/.pyenv/lib/python2.4/site-packages/PIL/__init__.py&#8221;, line 25, in __init__</p>
<p>TypeError: __init__() got an unexpected keyword argument &#8216;allow_none&#8217;<br />
x-ip@x-ip-lain:~/workspace/gibeta$
</p></blockquote>
<p>Estan avisados! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Bueno, perfecto! lo tenemos trabajando. Algo con lo que me encontre fue que al seguir la documentacion para aprender este framework en: http://trac.getwindmill.com/wiki/WindmillBook al seguir este ejemplo:</p>
<blockquote><p>
x-ip@x-ip-lain: ./bin/python ./bin/windmill firefox http://www.example.com
</p></blockquote>
<p>Me daba un error por buscar en /usr/lib/firefox-$miversion/ esto &#8216;<strong>mozrunner-firefox</strong>&#8216; lo cual,<br />
solucione con un enlace simbolico de esta forma:</p>
<blockquote><p>
x-ip@x-ip-lain:/usr/lib/firefox-3.0.4$ pwd<br />
/usr/lib/firefox-3.0.4</p>
<p>x-ip@x-ip-lain:/usr/lib/firefox-3.0.4$ sudo su<br />
[sudo] password for x-ip:</p>
<p>root@x-ip-lain: ln -ls /usr/lib/firefox-3.0.4/firefox /usr/lib/firefox-3.0.4/mozrunner-firefox</pre>
</blockquote>
<p>Solucionado esto pude correr satisfactoriamente:</p>
<blockquote><p>
x-ip@x-ip-lain: ./bin/python ./bin/windmill firefox http://www.google.com
</p></blockquote>
<p>Eso es todo, espero les halla sido de utilidad <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=45&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/11/21/functional-tests-windmillbook-impresionante/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>
	</item>
		<item>
		<title>Test, tests, and more tests</title>
		<link>http://ekisip.wordpress.com/2008/11/17/test-tests-and-more-tests/</link>
		<comments>http://ekisip.wordpress.com/2008/11/17/test-tests-and-more-tests/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 14:50:45 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=43</guid>
		<description><![CDATA[Unit Testing
Obtenido de: http://plone.org/documentation/tutorial/five-zope3-walkthrough/tests
Author: Jean-Francois Roche http://plone.org/author/jfroche
Test driven development has proved to be a really great practice for productive developers.  And that&#8217;s why writing tests for every new functionality, for every change and bug fix, is now done by  most of the Zope/Plone developer community. (So much so that if you submit code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=43&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h2>Unit Testing</h2>
<p>Obtenido de: http://plone.org/documentation/tutorial/five-zope3-walkthrough/tests</p>
<p>Author: <a href="http://plone.org/author/jfroche">Jean-Francois Roche</a> http://plone.org/author/jfroche</p>
<p>Test driven development has proved to be a really great practice for productive developers.  And that&#8217;s why writing tests for every new functionality, for every change and bug fix, is now done by  most of the Zope/Plone developer community. (So much so that if you submit code and want your code released, don&#8217;t imagine it will see the light of day without tests!).</p>
<p>Writing tests takes time, and you <em>must</em> take the time to write them. Once written that time will be payed back many times. Well planned tests will show you that your changes, bug fixes,  and refactoring didn&#8217;t create other bugs in your code, and will prevent you losing time looking for them.</p>
<p>Testing is magic, it transforms a developer into a user. When you are writing your tests you place yourself in the user&#8217;s skin and begin to see how he might use your code. This can show you how nice your code is: where are the obscure parts, the hard to understand methods, the wrong class decompositions, etc.</p>
<p>You know that one of the biggest assets of Plone is its community. Tests are even more important in collective code for two main reasons:</p>
<ol>
<li> You want to share with others your functionalities, your way of         coding, your way of thinking and show the right way how to use these         functionalities.</li>
<li> Many different people can/could write inside your code, if many         tests are already written they can assure themselves that the code         they write doesn&#8217;t break yours.</li>
<li> It covers you when the maintainer, or release manager come to scream at         you that you broke something with your last changes.</li>
</ol>
<p>So all this is about verifying your code and explaining it to others.</p>
<h3>Tests should:</h3>
<ul>
<li>Be repeatable</li>
<li>Run without human intervention needed</li>
<li>Be concise</li>
<li>Tell a story</li>
<li>Not test obvious things</li>
<li>Be deterministic</li>
</ul>
<h2>PloneTestCase</h2>
<p>When you create tests for Plone, you don&#8217;t want to lose time <span class="highlightedSearchTerm">install</span>ing a Plone portal, or other basic Zope/Plone products. So to get quicker test results, we use a unit test  framework that create automated unit tests suites. Plone has its own: PloneTestCase. As Plone is based on Zope, PloneTestCase is a layer on the top of the ZopeTestCase (the zope unit test framework &#8211; which is based on Python&#8217;s  unittest package [and if you want to know the whole story, python's unittest package is based on Java's JUnit and the Smalltalk testing framework]). This framework is a huge help for running your test quickly, often and with clear results.</p>
<h3>Vocabulary</h3>
<p>By <em>test</em> we mean a test method.</p>
<p>By <em>unittest</em> we mean a class which contains all the test methods      (if you want to use the Plone test framework, this class should inherit      from PloneTestCase).</p>
<p>By <em>unittest suite</em> we mean a collection of unittest.</p>
<p>We will describe here a bunch of basic things available in PloneTestCase and that we use a lot in the next sections.</p>
<h3>Products <span class="highlightedSearchTerm">Install</span>ed:</h3>
<p>Here is the list of default <span class="highlightedSearchTerm">install</span>ed products. If you need additional     products you will have to <span class="highlightedSearchTerm">install</span> them explicitly with the method we     describe later.</p>
<h4>Zope</h4>
<ul>
<li>ZCTextIndex</li>
<li>MailHost</li>
<li>PageTemplates</li>
<li>PythonScripts</li>
<li>ExternalMethod</li>
<li>GroupUserFolder</li>
<li>Five</li>
</ul>
<h4>CMF</h4>
<ul>
<li>CMFCore</li>
<li>CMFDefault</li>
<li>CMFCalendar</li>
<li>CMFTopic</li>
<li>DCWorkflow</li>
<li>CMFUid</li>
<li>CMFActionIcons</li>
<li>CMFQuick<span class="highlightedSearchTerm">Install</span>erTool</li>
<li>CMFFormController</li>
</ul>
<h4>Plone &#8211; Archetypes</h4>
<ul>
<li>Archetypes</li>
<li>MimetypesRegistry</li>
<li>PortalTransfroms</li>
<li>ATContentTypes</li>
<li>ATReferenceBrowserWidget</li>
<li>CMFDynamicViewFTI</li>
<li>ExternalEditor</li>
<li>ExtendedPathIndex</li>
<li>ResourceRegistries</li>
<li>SecureMailHost</li>
<li>kupu</li>
</ul>
<p>and, last but not least, CMFPlone.</p>
<p>In Plone 2.5 other important products are also <span class="highlightedSearchTerm">install</span>ed:       <span class="highlightedSearchTerm">CMFPlacefulWorkflow</span>, PlonePAS&#8230;</p>
<h3>Objects <span class="highlightedSearchTerm">install</span>ed:</h3>
<h4>Here are the objects you can use when you instantiate a PloneTestCase:</h4>
<ul>
<li>self.portal : a fresh Plone Portal <span class="highlightedSearchTerm">install</span> with all the portal tools you need                      inside.</li>
<li>self.folder : when running a PloneTestCase you are logged as a                      default user. This (empty) folder is the home folder of the                      default user. As it will be                      important for you to be able to do everything you need in                      this folder, default user is the owner of this folder.</li>
</ul>
<h3>Useful Methods you can use:</h3>
<p>Here are the methods you can use on the <code>self</code> object (inside the PloneTestCase      instance):</p>
<ul>
<li>addProduct(name) : Uses the quick<span class="highlightedSearchTerm">install</span>er to <span class="highlightedSearchTerm">install</span> a products                           inside the Plone portal (self.portal). So if you                           defined your Product and your content type, don&#8217;t                           forget to <span class="highlightedSearchTerm">install</span> it in the Plone Portal before trying to                           invoke it.</li>
<li>setRoles(roles, name=default_user)  : Change the current user&#8217;s roles                           (roles can be a string, a tuple or a list). Really important                           if you want to check security issues. You can also                           change the roles of other users by setting the name                           parameter.</li>
<li>setGroup(groups, name=default_user) : Change the current user&#8217;s                           groups (groups can be a string, a tuple or a list). You can also                            change the groups for other users by setting the name parameter.</li>
<li>setPermissions(permissions, role) : Change the permissions on the                           portal object for the role. Permissions can be a                           string, a tuple or a list. Role must be a string.</li>
<li>login(name) : It&#8217;s sometimes clearer to create new users                       with different roles or groups and after that                      login in as these users.</li>
<li>logout() : You want to be relegated to Anonymous inside the Plone instance? Use this method.</li>
</ul>
<h3>Unit Test Setup</h3>
<p>The testing framework will run all the methods inside any class      where the method name starts with <em>test</em>. So testMethod1(self) will be      automatically run by the framework and you won&#8217;t have to bother anymore      about explicitly calling it somewhere.</p>
<p>You might often want to repeat the same initialization before calling your test      method. The framework gives you an powerful method for that:</p>
<ul>
<li>afterSetUp(self) : You should put in this method all the code you want                      to do <em>before</em> running each of your test methods.</li>
</ul>
<p><img src="http://plone.org/documentation/tutorial/five-zope3-walkthrough/unittest.png" alt="Unit Test Setup" /></p>
<h3>Assertion Testing Methods (python unittest based)</h3>
<p>With test there is a known input and an expected output. This      input-output correctness is checked by assertion.      Python unittest package give us a range of methods to test assertions:</p>
<ul>
<li>failIf(expression) : Fail the test if the expression is true.</li>
<li>failUnless(expression) : Fail the test unless the expression is                                 true.</li>
<li>failUnlessEqual(first, second) : Fail if the two objects are unequal                                         as determined by the <code>==</code> operator.</li>
<li>failIfEqual(first, second) : Fail if the two objects are equal as                                     determined by the <code>==</code> operator.</li>
<li>fail(msg) : Fail immediately, with the given message.</li>
<li>failUnlessRaises(excClass, callableObj, <em>args, </em>*kwargs) : Fail      unless an exception of class excClass is thrown by callableObj when      invoked with arguments args and keyword arguments kwargs.</li>
</ul>
<h3>Failure and Errors</h3>
<p>Failures and Errors are two different things!</p>
<p>Failures occur when an assertion has failed (you were expecting the opposite result from the      test assertion).</p>
<p>Errors occur when something you didn&#8217;t expect occurs (exceptions, errors in your code&#8230;).</p>
<p>Let&#8217;s create a test! You learn better with practice. You will see it&#8217;s easy.</p>
<p>Common practice is to create a test class for each class you want to test and one (and sometimes more) test method for each important method in your class (getter and setter are often left untested due to their obviousness).</p>
<p>First download the PloneTestCase (http://plone.org/products/plonetestcase  or from svn https://svn.plone.org/svn/collective/PloneTestCase/trunk/) and extract it in your favourite Zope Products folder (let&#8217;s assume that you installed Plone in there <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ).</p>
<p>Let&#8217;s take the PloneTestCase class with all the things we need inside:</p>
<pre>    &gt;&gt;&gt; from Products.PloneTestCase import PloneTestCase</pre>
<p>Let&#8217;s say we want to test some of the Plone Document (ATDocument)   behaviour. Let&#8217;s create a class which will use this great PloneTestCase we    have just imported:</p>
<pre>    class TestATDocument(PloneTestCase):
         """
           A basic test case for Plone Document
         """
         pass</pre>
<p>Here it is we have done our first Plone test case. Not hard ? Yes i agree   this doesn&#8217;t test much <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Let&#8217;s test two things:</p>
<p>1) when I edit the title of        my document, I want it to be edited correctly (I agree that we are        basically testing obvious thing here, let&#8217;s keep things simple).</p>
<p>2) when I add a document, I want to it to be inside the Plone Catalog.</p>
<p>As you see in these two tests we will need a basic document created, so   let&#8217;s do it once in the afterSetUp method so that our document will be created    before each test.</p>
<p>Remember that each testing method must begin with test. Let&#8217;s create   testDocument.py:</p>
<pre>     class TestATDocument(PloneTestCase):
          """
            A less basic test case for Plone Document
          """
          def afterSetUp(self):
             """
               Let's create in our home folder the document we need
             """
             self.folder.invokeFactory('Document', id='doc')
             # We now have a document with id "doc" inside our home folder

          def testEditTitle(self):
             """
              Let's see if a title change on the document goes well
             """
             self.folder.doc.setTitle('A wonderful document title')
             self.assertEqual(self.folder.doc.Title, 'A wonderful document title')
             # this will fail if the setTitle didn't  correctly do its job!

          def testDocumentInCatalog(self):
             """
               Let's see if the document is in the catalog
             """
             # the catalog is in the Plone portal
             self.failUnless(self.portal.portal_catalog(getId='doc'))</pre>
<p>And there it is. If this passes we can be sure that we can change the title   of a document and that once created a document is in the plone catalog.</p>
<p>Now comes the time to include our fresh testcase inside a testsuite and to   run our tests.</p>
<h3>To be able to run this you will need two files :</h3>
<ul>
<li>framework.py : To be able to run test from python you will need to                       setup a few PATHs, this file will do most of the job for you.</li>
<li>runalltests.py : This small python code will just run all the files in                         the current directory which begin the the word test.</li>
</ul>
<p>Copy these files from the PloneTestCase folder to the folder where all your test cases are (often   the &#8220;tests&#8221; folder).</p>
<p>So, to run the test suite, we will need to decorate our PloneTestCase. To add a bit   of difficulty I want also to install a product inside my portal which   isn&#8217;t provided in the above list. Let&#8217;s say I want to use the Plone Language   Tool (I agree, we won&#8217;t need it for executing our test):</p>
<pre>       # First, above all, execute the framework.py

       import os, sys
       if __name__ == '__main__':
          execfile(os.path.join(sys.path[0], 'framework.py'))

       # Install the PloneLanguageTool Product in Zope

       from Testing import ZopeTestCase
       ZopeTestCase.installProduct('PloneLanguageTool')

       # Initialize our Plone and default install PloneLanguageTool in it

       from Products.PloneTestCase import PloneTestCase
       PloneTestCase.setupPloneSite(products=['PloneLanguageTool'])

       # Here it is, everything installed. We can put here our testcase...

       class TestATDocument(PloneTestCase.PloneTestCase):
             """
               A less basic test case for Plone Document
             """
             def afterSetUp(self):
                """
                  Let's create in our home folder the document we need
                """
                self.folder.invokeFactory('Document', id='doc')
                # We now have a document with id "doc" inside our home folder

             def testEditTitle(self):
                """
                  Let's see if a title change on the document goes well
                """
                self.folder.doc.setTitle('A wonderful document title')
                self.assertEqual(self.folder.doc.Title(), 'A wonderful document title')
                # this will fail if the setTitle didn't correctly do its job!

             def testDocumentInCatalog(self):
                """
                  Let's see if the document is in the catalog
                """
                # the catalog is in the Plone portal
                self.failUnless(self.portal.portal_catalog(getId='doc'))

       # Now we need our testcase inside a test suite.

       def test_suite():
            from unittest import TestSuite, makeSuite
            suite = TestSuite()
            suite.addTest(makeSuite(TestATDocument))
            return suite

       # and if you want to be able to run your suite directly (python testDocument.py)

       if __name__ == '__main__':
            framework()</pre>
<p>Everything is set up now. Last thing to do is to say where your zope is in your   system. On Unix based system you can do this like so :</p>
<pre>      export SOFTWARE_HOME=/usr/lib/zope2.9/lib/python</pre>
<h3>Now you have two ways to run your test suite, either</h3>
<ul>
<li>&#8220;python runalltests.py&#8221;  : Which will look in every file with the                                   name beginning with &#8220;test&#8221; and run all defined                                   test suites.</li>
<li>&#8220;python testDocument.py&#8221; : Which will run the specified test suite.</li>
</ul>
<h3>While running you will see</h3>
<p>1) Installation of the Zope &#8211; Products</p>
<h4>2) Once executed, a single test (method) will be represented by:</h4>
<p>&#8220;.&#8221; : which means that your test ran correctly.</p>
<p>&#8220;F&#8221; : which means that your test failed (you will get more                   information at the end).</p>
<p>&#8220;E&#8221; : which means that your test has error (you will get more                   information at the end).</p>
<p>Each time a test fails or has an error you will get a traceback and   more verbose information about the failure/error.</p>
<h2>DocTest</h2>
<p>What do you see in the word &#8220;DocTest&#8221;? Doc and Test. So a doctest is documentation and, at the same time, a test that proves that your code is working.</p>
<p>Many argue that people should read  unit tests and they should be clear enough   so that no more verbose comments should be added. It&#8217;s correct that tests    should be clear but I wouldn&#8217;t be that strict. I think the more people I   can explain my code to, the more feedback I will get .</p>
<p>Although we consider test cases as developer documentation, doctest is   considered as a middle technique between documentation and test case.   No more stale and useless documentation! Doctest enables living documentation,    always in step with the current implementation.</p>
<p>A doctest is a text, or structured text file (which should be written inside the   docs folder of your package/products). So inside this file you will   explain your code and at the same time you will be able to call python   code. To call python code just do:</p>
<pre>    &gt;&gt;&gt;</pre>
<p>This represents a call to the python interpreter. Around it you can place   your explanation. If your python code returns something, you have to do   exactly the same as if you would call this code from a python   interpreter session. For example:</p>
<pre>    &gt;&gt;&gt; print 'hello world'
    hello world</pre>
<p>The return value must be written at the same indentation level as the &gt;&gt;&gt;</p>
<p>One problem is that one doctest represents in itself more than one test. You   want to  show multiple things inside your doctest, but afterSetUp is only   run once before execution of the whole doctest. One doctest represents one python    session. So if i do:</p>
<pre>    &gt;&gt;&gt; a = 'hello'</pre>
<p>My variable a will be set to <code>hello</code> until the end of the document. Never forget   that, it could lead to some big problems!</p>
<p>By the way, all this document is a doctest for the ATContentTypes products. It can be   executed there.</p>
<h3>Vocabulary:</h3>
<ul>
<li>a doctest &#8220;file&#8221; will represent the txt file which include our doctest.</li>
<li>a doctest &#8220;class&#8221; will represent the unittest class that defines a doctest.</li>
</ul>
<p>Once written, the doctest file should be linked to a testcase class and a   testsuite. So let&#8217;s see how do we setup a doctest in the test part (this   should go inside a python file in the tests folder &#8211; with a file name   which begins with test):</p>
<pre>      # Like before we use the framework.py

      import os, sys
      if __name__ == '__main__':
           execfile(os.path.join(sys.path[0], 'framework.py'))

      # We install plone as usual. We want to test plone related stuff in
      # our doctest

      from Products.PloneTestCase import PloneTestCase
      PloneTestCase.setupPloneSite()

      # then we need the zope doctestsuite and link our doctest text file
      # with a functional test case

      from Testing.ZopeTestCase import FunctionalDocFileSuite
      from Products.PloneTestCase.PloneTestCase import FunctionalTestCase

      # we have a doctest file named archive.txt which is located in
      # ATContentTypes inside the docs folder (I say it again, the doctest file
      # should always be inside the docs folder, not in tests folder).

      def test_suite():
            import unittest
            suite = unittest.TestSuite()
            suite.addTest(FunctionalDocFileSuite('archive.txt',
                                                 package="Products.ATContentTTypes.docs",
                                                 test_class=FunctionalTestCase
                                                 )
                            )
      if __name__ == '__main__':
            framework()</pre>
<p>As usual you can run  this file directly, or just run <code>python runalltests.py</code>.</p>
<p>Now imagine that you want to prepare some things inside your testcase   class before running your doctest file (archive.txt). It&#8217;s easy, just create your   test class which inherits from FunctionalTestCase, define the afterSetUp   method and change the test suite to use your class. Let&#8217;s do it&#8230;</p>
<p>Be careful with this, it could confuse the people reading your doctest   file if you don&#8217;t explain clearly that you have already created tests in   the doctest class.</p>
<p>We keep it basic. We imagine that we really need to create a document inside   the home folder but don&#8217;t need to show that in the doctest file:</p>
<pre>      import os, sys
      if __name__ == '__main__':
           execfile(os.path.join(sys.path[0], 'framework.py'))

      from Products.PloneTestCase import PloneTestCase
      PloneTestCase.setupPloneSite()

      # we will now subclass FunctionalTestCase and define our afterSetUp method
      from Products.PloneTestCase.PloneTestCase import FunctionalTestCase

      class TestArchiveWithDocument(FunctionalTestCase):
            """
               Our Functional test class with a document inside
            """

            def afterSetUp(self):
                """
                   Creating a document in the home directory that the archive doc test can use
                """
                self.folder.invokeFactory('Document', id='doc')

      # And that's all! No test method, the only test method will be our
      # doctest file.  

      # now we need to link our functional test class to our doctest file
      # inside a test suite:
      from Testing.ZopeTestCase import FunctionalDocFileSuite
      def test_suite():
            import unittest
            suite = unittest.TestSuite()
            suite.addTest(FunctionalDocFileSuite('archive.txt',
                                                 package="Products.ATContentTTypes.docs",
                                                 test_class=TestArchiveWithDocument
                                                 )
                            )
      if __name__ == '__main__':
            framework()</pre>
<p>Now you know everything about tests, you have no excuse anymore for not   writing them!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=43&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/11/17/test-tests-and-more-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>

		<media:content url="http://plone.org/documentation/tutorial/five-zope3-walkthrough/unittest.png" medium="image">
			<media:title type="html">Unit Test Setup</media:title>
		</media:content>
	</item>
		<item>
		<title>Donde trabajo &#8230; :D</title>
		<link>http://ekisip.wordpress.com/2008/11/12/donde-trabajo-d/</link>
		<comments>http://ekisip.wordpress.com/2008/11/12/donde-trabajo-d/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 20:49:50 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=26</guid>
		<description><![CDATA[       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=26&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div id="attachment_35" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0034.jpg"><img class="size-full wp-image-35" title="Yo programando 2" src="http://ekisip.files.wordpress.com/2008/11/foto-0034.jpg?w=270&#038;h=202" alt="Yo programando 2" width="270" height="202" /></a><p class="wp-caption-text">Yo programando 2</p></div>
<div id="attachment_36" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0040.jpg"><img class="size-full wp-image-36" title="Dioses del olimpo!" src="http://ekisip.files.wordpress.com/2008/11/foto-0040.jpg?w=270&#038;h=202" alt="Dioses del olimpo!" width="270" height="202" /></a><p class="wp-caption-text">Dioses del olimpo!</p></div>
<div id="attachment_37" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0050.jpg"><img class="size-full wp-image-37" title="Nuestra musa inspiradora!" src="http://ekisip.files.wordpress.com/2008/11/foto-0050.jpg?w=270&#038;h=202" alt="Nuestra musa inspiradora!" width="270" height="202" /></a><p class="wp-caption-text">Nuestra musa inspiradora!</p></div>
<div id="attachment_38" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0051.jpg"><img class="size-full wp-image-38" title="La musa inspiradora 2" src="http://ekisip.files.wordpress.com/2008/11/foto-0051.jpg?w=270&#038;h=202" alt="La musa inspiradora 2" width="270" height="202" /></a><p class="wp-caption-text">La musa inspiradora 2</p></div>
<div id="attachment_28" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0023.jpg"><img class="size-full wp-image-28" title="X-ip en un momento de inspiracion" src="http://ekisip.files.wordpress.com/2008/11/foto-0023.jpg?w=270&#038;h=202" alt="X-ip en un momento de inspiracion" width="270" height="202" /></a><p class="wp-caption-text">X-ip en un momento de inspiracion</p></div>
<div id="attachment_29" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0024.jpg"><img class="size-full wp-image-29" title="La 'Office'" src="http://ekisip.files.wordpress.com/2008/11/foto-0024.jpg?w=270&#038;h=202" alt="La 'Office'" width="270" height="202" /></a><p class="wp-caption-text">La &#39;Office&#39;</p></div>
<div id="attachment_30" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0028.jpg"><img class="size-full wp-image-30" title="El motti!" src="http://ekisip.files.wordpress.com/2008/11/foto-0028.jpg?w=270&#038;h=202" alt="El motti!" width="270" height="202" /></a><p class="wp-caption-text">El motti!</p></div>
<div id="attachment_31" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0029.jpg"><img class="size-full wp-image-31" title="sunos__ revelde" src="http://ekisip.files.wordpress.com/2008/11/foto-0029.jpg?w=270&#038;h=202" alt="sunos__ revelde" width="270" height="202" /></a><p class="wp-caption-text">sunos__ revelde</p></div>
<div id="attachment_33" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0031.jpg"><img class="size-full wp-image-33" title="Mate y nuestros 'speakers' pa cucha musica" src="http://ekisip.files.wordpress.com/2008/11/foto-0031.jpg?w=270&#038;h=202" alt="Mate y nuestros 'speakers' pa cucha musica" width="270" height="202" /></a><p class="wp-caption-text">Mate y musica</p></div>
<div id="attachment_34" class="wp-caption aligncenter" style="width: 280px"><a href="http://ekisip.files.wordpress.com/2008/11/foto-0032.jpg"><img class="size-full wp-image-34" title="El motti y sunos!" src="http://ekisip.files.wordpress.com/2008/11/foto-0032.jpg?w=270&#038;h=202" alt="El motti y sunos!" width="270" height="202" /></a><p class="wp-caption-text">El motti y sunos!</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=26&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/11/12/donde-trabajo-d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0034.jpg" medium="image">
			<media:title type="html">Yo programando 2</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0040.jpg" medium="image">
			<media:title type="html">Dioses del olimpo!</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0050.jpg" medium="image">
			<media:title type="html">Nuestra musa inspiradora!</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0051.jpg" medium="image">
			<media:title type="html">La musa inspiradora 2</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0023.jpg" medium="image">
			<media:title type="html">X-ip en un momento de inspiracion</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0024.jpg" medium="image">
			<media:title type="html">La 'Office'</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0028.jpg" medium="image">
			<media:title type="html">El motti!</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0029.jpg" medium="image">
			<media:title type="html">sunos__ revelde</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0031.jpg" medium="image">
			<media:title type="html">Mate y nuestros 'speakers' pa cucha musica</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/11/foto-0032.jpg" medium="image">
			<media:title type="html">El motti y sunos!</media:title>
		</media:content>
	</item>
		<item>
		<title>Doctests, Huh?</title>
		<link>http://ekisip.wordpress.com/2008/11/04/doctests-huh/</link>
		<comments>http://ekisip.wordpress.com/2008/11/04/doctests-huh/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 12:15:24 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=24</guid>
		<description><![CDATA[- &#8211; - &#8211; - &#8211; - &#8211; - &#8211; - -
By Brian Sutherland  &#124; 
Articulo copiado de : http://www.pyzine.com/Issue008/Section_Articles/article_Doctests.html
For good code to be useful, it requires two additional things: good documentation and good unit testing. Doctests allow the programmer to do both at the same time with the additional benefits that the documentation is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=24&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!--END HEADER--><span class="textSUBheadline">- &#8211; - &#8211; - &#8211; - &#8211; - &#8211; - -</span><br />
<span class="textBB">By Brian Sutherland  | </span></p>
<p>Articulo copiado de : http://www.pyzine.com/Issue008/Section_Articles/article_Doctests.html</p>
<p>For good code to be useful, it requires two additional things: good documentation and good unit testing. Doctests allow the programmer to do both at the same time with the additional benefits that the documentation is tested and the prose between the tests documents the tests themselves. There are few things worse than undocumented unit tests which over time grow contorted by special cases until they are as understandable as black magic. Forming a link between code, documentation and testing is the greatest advantage of doctests.</p>
<p>Normally in a project there are three things you want to test using doctests:</p>
<ul class="simple">
<li>Examples in the docstrings of functions, classes and modules showing their use and testing major functionality.</li>
<li>Documentation to be sure code examples are correct.</li>
<li>Regression testing to make sure past bugs don&#8217;t re-appear (Regression tests can become very obscure, so normally these should be separated from the rest to avoid over-complicating the documentation).</li>
</ul>
<p>Each of these three have a different purpose and in a well structured project should be separated so that they can serve their purpose well. For example, including regression tests in the docstrings of a module will, over time, over-complicate the module&#8217;s docstrings. This interferes with the primary use of module docstrings i.e. understanding what the module does.</p>
<p>There are three API&#8217;s for writing doctests, a simple API, a <tt class="docutils literal"><span class="pre">unittest</span></tt> API and an advanced API. This article focuses on the <tt class="docutils literal"><span class="pre">unittest</span></tt> API as it is simple enough to learn very quickly, can be combined with more traditional python unit tests and can deal with almost almost every testing problem. In short, a very good compromise.</p>
<p>First we need to set up a project tree with some packages and modules, so just create a directory structure like this:</p>
<pre class="literal-block">src/fruit/__init__.py
src/fruit/freshfruit.py
src/fruit/freshfruit-tutorial.txt   -&gt; documentation
src/fruit/tests/__init__.py
src/fruit/tests/test_freshfruit.py  -&gt; regression testing</pre>
<p>Next we need some way to run the tests we are going to write. The best is probably to have a test runner script in the top level directory. You can roll your own, but I&#8217;m going to grab one from the Zope project. Just drop <a class="reference" href="http://svn.zope.org/Zope3/trunk/src/zope/app/testing/test.py">test.py</a> into the top level of of the project, make sure you have python 2.4 and the python profiler(Debian specific) installed and we can begin.</p>
<div id="testing-docstrings-in-modules" class="section"><span class="textBB">Testing Docstrings in Modules</span>So what is the first thing to do with fresh fruit. Make a Salad! So we write some tests in and classes in freshfruit.py then fill in the code. Have a look at how easy it is to understand the code from the test examples. freshfruit.py:</p>
<pre class="literal-block">"""
This module makes salads, it implements a FoodProcessor to process
ingredients which are then added to the SaladBowl container.
"""

class FoodProcessor:
    """This class contains various food processing functions."""

    def diceCarrot(self, str):
        """This function dices carrots.

            &gt;&gt;&gt; processor = FoodProcessor()
            &gt;&gt;&gt; processor.diceCarrot('carrot')
            'diced carrot'

        and returns a ValueError if the input is not a carrot:

            &gt;&gt;&gt; processor.diceCarrot('A diced carrot')
            Traceback (most recent call last):
                ...
            ValueError: 'A diced carrot' is not a carrot
        """
        if str == 'carrot':
            return 'diced carrot'
        else:
            raise ValueError("%s is not a carrot" % repr(str))

    def peelBanana(self, str):
        """This function peels bananas.

            &gt;&gt;&gt; processor = FoodProcessor()
            &gt;&gt;&gt; processor.peelBanana('banana')
            'peeled banana'

        and returns a ValueError if the input is not a banana:

            &gt;&gt;&gt; processor.peelBanana('A peeled banana')
            Traceback (most recent call last):
                ...
            ValueError: 'A peeled banana' is not a banana
        """
        if str == 'banana':
            return 'peeled banana'
        else:
            raise ValueError("%s is not a banana" % repr(str))

class SaladBowl:
    """This is a container for processed ingredients.

    Then you can make a salad bowl and add the prepared ingredients

        &gt;&gt;&gt; bowl = SaladBowl()
        &gt;&gt;&gt; bowl.addIngredient('peeled banana')
        &gt;&gt;&gt; bowl.addIngredient('diced carrot')
        &gt;&gt;&gt; bowl.addIngredient('peeled banana')

    Finally, most people would want to eat it:

        &gt;&gt;&gt; bowl.eat()
        That peeled banana was tasty!
        That diced carrot was tasty!
        That peeled banana was tasty!
    """

    def __init__(self):
        self.contents = []

    def addIngredient(self, addition):
        """Adds ingredients to the salad bowl.

        Make a SaladBowl

            &gt;&gt;&gt; bowl = SaladBowl()

        Add all the ingredients in a string

            &gt;&gt;&gt; bowl.addIngredient('peeled banana')
            &gt;&gt;&gt; bowl.addIngredient('diced carrot')
            &gt;&gt;&gt; bowl.contents
            ['peeled banana', 'diced carrot']

        """
        self.contents.append(addition)

    def eat(self):
        """Eat the contents of the SaladBowl.

        First set up a salad bowl:

            &gt;&gt;&gt; bowl = SaladBowl()
            &gt;&gt;&gt; bowl.contents = ['diced carrot', 'peeled banana']

        eat() out a eating message for all contents of the salad bowl.

            &gt;&gt;&gt; bowl.eat()
            That diced carrot was tasty!
            That peeled banana was tasty!

        and removes them from the bowl:

            &gt;&gt;&gt; bowl.contents
            []
        """
        while self.contents:
            print "That %s was tasty!" % self.contents.pop(0)</pre>
<p>Also we need to set up the test runner so that it knows which module to test in test_freshfruit.py. This code should do the trick:</p>
<pre class="literal-block">import unittest
import doctest

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(doctest.DocTestSuite('fruit.freshfruit'))
    return suite</pre>
<p>Running the test.py script that we dropped into the top level directory with</p>
<p>&gt; python2.4 test.py</p>
<p>should show you that 5 unit tests were run successfully. Try changing the code or the tests to find out what happens when things fail.</p>
<p>As you may have noticed, each docstring is run in its own namespace, so it is necessary to define class instances for every test (i.e. <tt class="docutils literal"><span class="pre">bowl</span></tt> and <tt class="docutils literal"><span class="pre">processor</span></tt>).  To make life easier, you can define them in extra parameters to the <tt class="docutils literal"><span class="pre">DocTestSuite</span></tt> call. Explaining exactly how to do this is too much for this article, but the <a class="reference" href="http://www.python.org/doc/2.4/lib/module-doctest.html">doctest documentation</a> is excellent.</p>
<p>Also, you don&#8217;t have to write the entirety of an exception, doctests will ignore all indented text between the first and last lines of an exception. The <tt class="docutils literal"><span class="pre">...</span></tt> used in the examples is just a convention, but makes for more readable documentation than a copy of the exception itself.</p>
<p>Of the many doctest options there are two which are incredibly useful. The first, <tt class="docutils literal"><span class="pre">doctest.NORMALIZE_WHITESPACE</span></tt> causes the doctest module not to worry whether the whitespace in your test example is exact (Having failing tests because of trailing whitespace can be incredibly irritating). The second, <tt class="docutils literal"><span class="pre">doctest.ELLIPSIS</span></tt> makes <tt class="docutils literal"><span class="pre">...</span></tt> match any substring in the test output, much like <tt class="docutils literal"><span class="pre">.*</span></tt> in regular expressions. Of course these should be used with care as they can cause failing tests to appear to work!</p>
<p>You can add these options to to the testing framework by modifying test_freshfruit.py as follows:</p>
<pre class="literal-block">import unittest
import doctest

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(doctest.DocTestSuite('fruit.freshfruit',
            optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE))
    return suite</pre>
</div>
<div id="testing-tutorial-documentation" class="section"><span class="textBB">Testing Tutorial Documentation</span>If you want to write tutorial documentation, doctests make it possible to add interactive code examples in plain text files, you can try this by adding</p>
<pre class="literal-block">Making a salad
--------------

To make a salad, you first have to get a food processor:

&gt;&gt;&gt; from fruit.freshfruit import FoodProcessor
&gt;&gt;&gt; processor = FoodProcessor()

Then to process the food, you can dice some carrots:

&gt;&gt;&gt; diced_carrot = processor.diceCarrot('carrot')
&gt;&gt;&gt; diced_carrot
'diced carrot'

and peel some bananas:

&gt;&gt;&gt; peeled_banana1 = processor.peelBanana('banana')
&gt;&gt;&gt; peeled_banana2 = processor.peelBanana('banana')
&gt;&gt;&gt; peeled_banana2
'peeled banana'

You can also get a salad bowl and put the ingredients in:

&gt;&gt;&gt; from fruit.freshfruit import SaladBowl
&gt;&gt;&gt; bowl = SaladBowl()
&gt;&gt;&gt; bowl.addIngredient(diced_carrot)
&gt;&gt;&gt; bowl.addIngredient(peeled_banana1)
&gt;&gt;&gt; bowl.addIngredient(peeled_banana2)

Finally, you can eat and enjoy:

&gt;&gt;&gt; bowl.eat()
That diced carrot was tasty!
That peeled banana was tasty!
That peeled banana was tasty!</pre>
<p>to freshfruit-tutorial.txt and slightly modifying test_freshfruit.py to:</p>
<pre class="literal-block">import os
import unittest
import doctest

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(doctest.DocFileSuite(
        os.path.join('..', 'freshfruit-tutorial.txt')))
    suite.addTest(doctest.DocTestSuite('fruit.freshfruit',
            optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE))
    return suite</pre>
<p>As you can see, the text file is parsed exactly like one large docstring. Simple!</p></div>
<div id="regression-testing" class="section"><span class="textBB">Regression Testing</span>Finally, fruit is released and the bug reports start to roll in. Some people want to dice Unicode carrots and others BANANAS. In fact, there are so many different types of carrots and bananas, that testing every special case will make the in-module and tutorial documentation impossible to read.</p>
<p>This is what the <tt class="docutils literal"><span class="pre">test_freshfruit.py</span></tt> file is for. Simply adding <tt class="docutils literal"><span class="pre">doctest.DocTestSuite()`</span> <span class="pre">will</span> <span class="pre">test</span> <span class="pre">all</span> <span class="pre">of</span> <span class="pre">the</span> <span class="pre">docstrings</span> <span class="pre">in</span> <span class="pre">``test_freshfruit.py</span></tt>. Regression tests can be added as functions containing only docstrings without fear that they will complicate the documentation. As an example, this test_freshfruit.py includes the tests for Unicode and capitalisation:</p>
<pre class="literal-block">import os
import unittest
import doctest

def doctest_Unicode():
    """Test to make sure that freshfruit.py deals with Unicode fruit.

    SetUp:

        &gt;&gt;&gt; from fruit.freshfruit import FoodProcessor
        &gt;&gt;&gt; processor = FoodProcessor()

    A Unicode bananas and carrots must return Unicode:

        &gt;&gt;&gt; processor.peelBanana(u'banana')
        u'peeled banana'
        &gt;&gt;&gt; processor.diceCarrot(u'carrot')
        u'diced carrot'
    """

def doctest_Capitalize():
    """Test to make sure that freshfruit.py deals with CAPITALIZATION.

    SetUp:

        &gt;&gt;&gt; from fruit.freshfruit import FoodProcessor
        &gt;&gt;&gt; processor = FoodProcessor()

    A BANANAs and CARROTs are also fruit:

        &gt;&gt;&gt; processor.peelBanana('BANANA')
        'peeled banana'
        &gt;&gt;&gt; processor.diceCarrot('CARROT')
        'diced carrot'
    """

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(doctest.DocFileSuite(
        os.path.join('..', 'freshfruit-tutorial.txt')))
    suite.addTest(doctest.DocTestSuite('fruit.freshfruit',
            optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE))
    suite.addTest(doctest.DocTestSuite())
    return suite</pre>
<p>As you can see, it is easy to see exactly what each regression test is testing. It is left as an exercise for the reader to code the solution.</p></div>
<div id="some-doctest-pitfalls" class="section"><span class="textBB">Some Doctest Pitfalls</span>There are of course, some caveats. Specifically, the parsed output:</p>
<ul class="simple">
<li>must be the same every time.</li>
<li>can be hard to fit into screen width.</li>
</ul>
<p>Even with these, doctests are still capable of being useful in almost every testing situation. For the rest, there is the Python <tt class="docutils literal"><span class="pre">unittest</span></tt> framework.</div>
<div id="finally" class="section"><span class="textBB">Finally</span>This short overview should be enough for a programmer to become productive with doctests immediately. He already has all the skills merely by knowing the python command line.</p>
<p>But perhaps the most important aspect of doctests is forcing a good style of documentation that is tested and correct. Every programmer knows the frustration of trying to understand a complex code without the aid of examples or comments. Think about them when you write your tests.</p></div>
<div id="further-reading-and-thanks" class="section"><span class="textBB">Further Reading and Thanks</span>For more information you should defiantly have a look at the doctest documentation for implementation, also Jim Fulton&#8217;s <a class="reference" href="http://www.python.org/pycon/dc2004/papers/4/PyCon2004DocTestUnit.pdf">PyCon 2004 presentation</a> and Phillip J. Eby&#8217;s <a class="reference" href="http://dirtsimple.org/2004/11/stream-of-consciousness-testing.html">essay</a> go a long way to describe the philosophy behind doctests.</p>
<p>With thanks to Marius Gedminas for introducing me to doctests and helping out with this article. Errors are, of course, mine.</p></div>
<hr size="1" noshade="noshade" /><span class="textBB">Brian Sutherland</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=24&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/11/04/doctests-huh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>
	</item>
		<item>
		<title>Development Environment en Plone</title>
		<link>http://ekisip.wordpress.com/2008/06/23/development-environment-en-plone/</link>
		<comments>http://ekisip.wordpress.com/2008/06/23/development-environment-en-plone/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 15:45:16 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=11</guid>
		<description><![CDATA[Para redactar este articulo use como guia el libro de Martin Aspeli &#8216;Professional Plone Development&#8217;. Puedes adquirirlo  Aqui 
Antes de comenzar a construir nuestra aplicacion, debemos armar nuestro entorno de desarrollo ( development environment)
Prerequisitos:
Paquetes precompilados de Zope y Plone estan disponibles para varios sistemas operativos. Estos mismos pueden ser de gran ayuda, pero como [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=11&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Para redactar este articulo use como guia el libro de <strong>Martin Aspeli &#8216;Professional Plone Development&#8217;</strong>. Puedes adquirirlo <a href="http://www.packtpub.com/Professional-Plone-web-applications-CMS/book"> Aqui </a></p>
<p>Antes de comenzar a construir nuestra aplicacion, debemos armar nuestro entorno de desarrollo ( <strong>development environment</strong>)</p>
<p><strong>Prerequisitos:</strong></p>
<p>Paquetes precompilados de Zope y Plone estan disponibles para varios sistemas operativos. Estos mismos pueden ser de gran ayuda, pero como developers usualmente es mejor tener dominio de toda la configuracion de nuestro entorno de desarrollo.</p>
<p>Sera necesario lo siguiente para poder trabajar:</p>
<p><strong>Python 2.4:</strong> Se asume que al escribir el comando python, la version del interprete sera la 2.4. Desafortunadamente, zope, en la version 2.10 no tiene soporte aun para Python 2.5. Notese que varias distribuciones de linux proveen dos paquetes para python, una conteniendo el binario y otra los <em>headers files</em>, llamados generalmente como python-dev o similar. Se precisaran ambos, el binario de Python2.4 y los <em>header files</em> para compilar Zope.</p>
<p><strong>PIL: </strong>the Python Imaging Library deberia ser instalado con nuestro interprete. Cuando vimos como crear un  <a href="http://ekisip.wordpress.com/2008/06/21/virtualenv-en-slackware-121/"> virtual python environment </a> al final del articulo logramos tener un interprete de python:</p>
<blockquote><p>bash-3.1$ ~/.pyenv/bin/python<br />
Python 2.4.4 (#1, Jun 15 2008, 17:41:52)<br />
[GCC 4.2.3] on linux2<br />
Type “help”, “copyright”, “credits” or “license” for more information.<br />
&gt;&gt;&gt;</p></blockquote>
<p>Pues para instalar nuestras dependencias / requisitos como en este caso PIL, deberiamos proceder como se detalla a continuacion:</p>
<blockquote><p>bash-3.1$ ~/.pyenv/bin/python /home/lain/.temp/PIL/setup.py install</p></blockquote>
<p>Con esto, la libreria de PIL quedara instalada en el <strong>site-packages</strong> de nuestro <strong>pyenv</strong>.</p>
<p><strong>Editor de texto:</strong> Se recomienda un editor de texto con soporte para python y highlighting para XML/HTML. Personalmente para maquinas con modestos recursos recomiendo vim y para aquellas maquinas mas poderosas recomiendo <a href="http://www.eclipse.org">Eclipse</a> (el IDE de java) con el plugin de <a href="http://pydev.sourceforge.net">PyDev</a>.</p>
<p><strong>elementtree:</strong> es una libreria que procesa XML, requerida por Plone al momento de iniciar. La mayoria de las distribuciones vienen con esta libreria. Tambien puede ser descargada de <a href="http://effbot.org/zopne/element-index.htm">Aqui</a></p>
<p><strong>Un Shell: </strong> Bash &#8230; zsh &#8230; lo que quieran siempre y cuando la sepan usar <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<strong>Un cliente de Subversion: </strong> El clasico <a href="http://subversion.tigris.org">Subversion</a>. Quiza hallan mejores opciones, comenten! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
<strong>Un compilador de C:</strong> Se necesita un compilador de C para compilar Zope. El venerable <a href="http://gcc.gnu.org">Gcc</a> va de lleno en sistemas tipo UNIX.</p>
<p><strong>Comienzo Veloz:</strong> (the quick way)</p>
<p>Si tienes los requisitos mencionados anteriormente y necesitas tener tu entorno de desarrollo en poco tiempo, aqui va la receta. Notese que el comando <em>easy_install</em> fue obtenido en el articulo <a href="http://ekisip.wordpress.com/2008/06/21/virtualenv-en-slackware-121/"> virtual python environment </a></p>
<blockquote><p>lain@lain:~$ ~/.pyenv/bin/easy_install-2.4 ZopeSkel</p></blockquote>
<p>ZopeSkel son <em>esqueletos / premoldes</em> que nos ahorraran mucho trabajo, errores y lineas de codigo como veremos mas adelante.<br />
Luego utilizamos <em>paster</em>, que fue instalado como dependencia de ZopeSkel para crear un nuevo <em>buildout</em>. Este directorio (el del buildout) contendra el codigo fuente y las dependencias, incluyendo el servidor de aplicaciones Zope.</p>
<blockquote><p>lain@lain:~/.tmp$ ~/.pyenv/bin/paster create -t plone3_buildout ~/.mybuildout</p></blockquote>
<p>Aqui utilizamos el comando <em>paster</em> al cual le pedimos que cree <em>algo</em> de tipo <em>plone3_buildout</em> en mi home, directorio <em>.mybuilldout</em>. La construccion y lo que debe hacer lo sabe a partir de <em>ZopeSkel</em> que lo instalamos anteriormente <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .<br />
Al correr este comando, paster nos hara algunas preguntas las cuales podemos dejar por default, excepto cuando nos pida el password, el cual es escogido por nosotros para luego ingresar como administradores como veremos mas adelante. En mi caso:</p>
<blockquote><p>Enter zope_password (Zope root admin password) ['']: changeme</p></blockquote>
<p>Escojo el puerto 9999. Tener en cuenta que si ingresamos un puerto dentro del <em>rango privilegiado</em> (0 &#8211; 1024), la instancia debera correr como root (innecesariamente), el por ello que elijo como puerto el 9999.</p>
<blockquote><p>Enter http_port (HTTP port) [8080]: 9999</p></blockquote>
<p>Dejamos en off el modo de debug, luego podremos manualmente indicarle al iniciar la instancia de que deseamos que se encuentre en modo debug:</p>
<blockquote><p>Enter debug_mode (Should debug mode be &#8220;on&#8221; or &#8220;off&#8221;?) ['off']: off</p></blockquote>
<p>Finalizado el proceso nos encontraremos con el siguiente texto:</p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Generation finished<br />
You probably want to run python bootstrap.py and then edit<br />
buildout.cfg before running bin/buildout -v</p>
<p>See README.txt for details<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p></blockquote>
<p>En hora buena! tenemos nuestro buildout &#8230; ahora solo falta <em>hacerlo funcionar!</em></p>
<p>Ingresamos a nuestro nuevo buildout</p>
<blockquote><p>lain@lain:~/.tmp/home/lain$ cd ~/.mybuildout/</p></blockquote>
<p>Corremos el bootstrap el cual nos creara unos scripts para luego armar nuestro buildout</p>
<blockquote><p>lain@lain:~/.mybuildout$ ~/.pyenv/bin/python ./bootstrap.py<br />
<strong>Creating directory &#8216;/home/lain/.mybuildout/bin&#8217;</strong>.<br />
Creating directory &#8216;/home/lain/.mybuildout/parts&#8217;.<br />
Creating directory &#8216;/home/lain/.mybuildout/eggs&#8217;.<br />
Creating directory &#8216;/home/lain/.mybuildout/develop-eggs&#8217;.<br />
Generated script &#8216;/home/lain/.mybuildout/bin/buildout&#8217;.</p></blockquote>
<p>Tiempo de comenzar a armar nuestro buildout! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<blockquote><p>lain@lain:~/.mybuildout$ ~/.pyenv/bin/python ./bin/buildout -v</p></blockquote>
<p>En este momento comenzara a bajar e instalar y acomodar todo para dejarnos una instancia lista de nuestro plone3 <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
Terminado el proceso podremos arrancar nuestra instancia. Poniendo <em>fg</em> como parametro arrancara nuestra instancia en <em>debug</em> mode.</p>
<blockquote><p>lain@lain:~/.mybuildout$ ./bin/instance fg</p></blockquote>
<p>Una vez arrancado nuestro buildout ingresamos con un web browser a <em></em>. En mi caso:</p>
<blockquote><p>lain@lain: links http://190.17.108.37:9999/manage</p></blockquote>
<p>Nos pedira un usuario y password. El usuario si no lo cambiaron en la construccion del buildout, es <em>admin</em> y el password es el que escogimos, en este articulo fue <em>changeme</em>.</p>
<p>Nos encontraremos con lo siguiente, la <strong>zmi</strong>! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />   (zope manager interface)</p>
<p><a href="http://ekisip.files.wordpress.com/2008/06/zmi1.jpg"><img class="aligncenter size-medium wp-image-12" src="http://ekisip.files.wordpress.com/2008/06/zmi1.jpg?w=300&#038;h=145" alt="Welcome to the Zmi" width="300" height="145" /></a></p>
<p>Desde ella, en el <em>drop-down</em> <em>box</em> donde dice AtContentTypes tool, escogemos <strong>Plone Site</strong> y luego click en <strong>Add</strong>. A lo que recibiremos la siguiente imagen:</p>
<p><a href="http://ekisip.files.wordpress.com/2008/06/zmi2.jpg"><img class="aligncenter size-medium wp-image-13" src="http://ekisip.files.wordpress.com/2008/06/zmi2.jpg?w=300&#038;h=145" alt="Adding a New Plone Site" width="300" height="145" /></a></p>
<p>En el campo <strong>ID </strong>he puesto <em>miplone</em>. Como dice el <em>field name</em>, este sera el id de nuestro sitio, cual utilizaremos para luego acceder a nuestro sitio plone siendo la url en mi caso http://190.17.108.37:9999/<em>miplone</em></p>
<p>En el campo <strong>Title</strong> he puesto <em>Mi sitio Plone Personal</em>, este sera el titulo de mi sitio. Luego podra ser cambiado <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Finalizado esto damos click en el boton <strong>Add Plone Site</strong> &#8230; y &#8230; ingresamos la esperada url, en mi caso: <em>http://190.17.108.37:9999/miplone</em> teniendo como resultado &#8230; lo siguiente! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><a href="http://ekisip.files.wordpress.com/2008/06/plone1.jpg"><img class="aligncenter size-medium wp-image-14" src="http://ekisip.files.wordpress.com/2008/06/plone1.jpg?w=300&#038;h=145" alt="Plone Site recently created" width="300" height="145" /></a></p>
<p>Esto es todo amigos &#8230; hemos creado desde cero nuestro buildout y tenemos nuestro sitio plone, quien quedara sujeto a todo tipo de pruebas mas adelante!.</p>
<p>Nos vemos en la proxima entrega <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ekisip.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ekisip.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=11&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/06/23/development-environment-en-plone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/06/zmi1.jpg?w=300" medium="image">
			<media:title type="html">Welcome to the Zmi</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/06/zmi2.jpg?w=300" medium="image">
			<media:title type="html">Adding a New Plone Site</media:title>
		</media:content>

		<media:content url="http://ekisip.files.wordpress.com/2008/06/plone1.jpg?w=300" medium="image">
			<media:title type="html">Plone Site recently created</media:title>
		</media:content>
	</item>
		<item>
		<title>SlackBuilds en Slackware 12.1</title>
		<link>http://ekisip.wordpress.com/2008/06/22/slackbuilds-en-slackware-121/</link>
		<comments>http://ekisip.wordpress.com/2008/06/22/slackbuilds-en-slackware-121/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 17:50:29 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Slackware]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=10</guid>
		<description><![CDATA[Dedicado a ASCIIGirl ^.^&#8221; (no soy mala onda x&#8217;D)
El proyecto SlackBuilds es mantenido por un pequenio grupo de personas que codifican scripts para el uso de la comunidad.
Este proyecto surge a raiz de una de las caracteristicas mas cuestionadas en Slackware &#8230; la &#8216;falta&#8217; de paquetes. Siendo Slackware una distribucion que provee una gran cantidad [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=10&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Dedicado a ASCIIGirl ^.^&#8221; (no soy mala onda x&#8217;D)</p>
<p>El proyecto <a href="http://slackbuilds.org">SlackBuilds</a> es mantenido por un pequenio grupo de personas que codifican scripts para el uso de la comunidad.</p>
<p>Este proyecto surge a raiz de una de las caracteristicas mas cuestionadas en Slackware &#8230; la &#8216;falta&#8217; de paquetes. Siendo Slackware una distribucion que provee una gran cantidad de paqutes que satisfacen variadas y diferentes necesidades, quedan aplicaciones que no estan incluidas oficialmente y pueden ser requeridas por ciertos usuarios.<br />
Son sabidos algunos servidores donde se suben paquetes precompilados para slackware de terceras partes, a lo cual varios usuarios justificandose reclamaron que no les era fiable el instalar estos paquetes en sus equipos por cuestiones de confianza, seguridad, etc. La solucion para estos usuarios en ese momento era descargar el codigo fuente de la aplicacion y compilarla manualmente, lo que traia inconvenientes por ejemplo en la administracion de sistemas a la hora de mantener las versiones de las distintas aplicaciones.</p>
<p>Solucionando este problema es que aparecen los muchachos de SlackBuilds, quienes codifican scripts que toman el source de la aplicacion y generan un paqute *.tgz, siguiendo la idea de Patrick Volkerding, quien utiliza SlackBuilds para generar los paquetes oficiales que se incluyen en cada release.</p>
<p>Habiendo tenido una pequenia introduccion sobre slackbuilds, veamos como utilizarlos. Para ello vamos a instalar yakuake, una terminal para kde muy bonita <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ingresamos a slackbuilds.org</p>
<blockquote><p>bash-3.1$ links slackbuilds.org</p></blockquote>
<p>Buscams el paquete yakuake, descargamos el source y el SlackBuild. Tambien descargamos el fichero que termina en .asc. Nos deben quedar estos ficheros:</p>
<blockquote><p>bash-3.1$ ls -l yakuake*<br />
-rw-r&#8211;r&#8211; 1 lain users 535406 2008-06-16 14:28 yakuake-2.8.1.tar.bz2<br />
-rw-r&#8211;r&#8211; 1 lain users   1938 2008-06-16 14:28 yakuake.tar.gz<br />
-rw-r&#8211;r&#8211; 1 lain users    197 2008-06-16 14:28 yakuake.tar.gz.asc</p></blockquote>
<p>Corroboramos con la llave publica yakuake.tar.gz.asc el Slackbuild yakuake.tar.gz:<br />
Si es la primera vez que realizamos esto, tendremos como resultado lo siguiente:</p>
<blockquote><p>bash-3.1$ gpg-verify.py yakuake.tar.gz.asc yakuake.tar.gz<br />
Verifying yakuake.tar.gz with yakuake.tar.gz.asc&#8230;</p>
<p>gpg: directory `/home/lain/.gnupg&#8217; created<br />
gpg: new configuration file `/home/lain/.gnupg/gpg.conf&#8217; created<br />
gpg: WARNING: options in `/home/lain/.gnupg/gpg.conf&#8217; are not yet active during this run<br />
gpg: keyring `/home/lain/.gnupg/pubring.gpg&#8217; created<br />
gpg: Signature made Wed 07 May 2008 03:08:34 PM ART using DSA key ID 9C7BA3B6<br />
<strong>gpg: Can&#8217;t check signature: public key not found</strong></p></blockquote>
<p>No puede encontrar la clave publica &#8230; pues la pedimos:</p>
<blockquote><p>bash-3.1$ gpg-req-key.py 9C7BA3B6<br />
Getting 9C7BA3B6 from blackhole.pca.dfn.de&#8230;</p>
<p>gpg: keyring `/home/lain/.gnupg/secring.gpg&#8217; created<br />
gpg: requesting key 9C7BA3B6 from hkp server blackhole.pca.dfn.de<br />
gpg: /home/lain/.gnupg/trustdb.gpg: trustdb created<br />
gpg: key 9C7BA3B6: public key &#8220;SlackBuilds.org Development Team &#8221; imported<br />
gpg: no ultimately trusted keys found<br />
gpg: Total number processed: 1<br />
gpg:               imported: 1</p></blockquote>
<p>Ahora nuevamente comprobamos el Slackbuild :</p>
<blockquote><p>bash-3.1$ gpg-verify.py yakuake.tar.gz.asc yakuake.tar.gz<br />
Verifying yakuake.tar.gz with yakuake.tar.gz.asc&#8230;</p>
<p>gpg: Signature made Wed 07 May 2008 03:08:34 PM ART using DSA key ID 9C7BA3B6<br />
gpg: <strong>Good signature</strong> from &#8220;SlackBuilds.org Development Team &#8220;<br />
gpg: WARNING: This key is not certified with a trusted signature!<br />
gpg:          There is no indication that the signature belongs to the owner.<br />
Primary <strong>key fingerprint: D307 6BC3 E783 EE74 7F09  B8B7 0368 EF57 9C7B A3B6</strong></p></blockquote>
<p>Perfecto &#8230; el warning se debe a que la llave no se encuentra firmada por una llave en la que yo tenga confianza. Para mas detalles sobre esto click <a href="http://www.gnupg.org/">Aqui</a><br />
Continuamos descomprimiendo el Slackbuild:</p>
<blockquote><p>bash-3.1$ tar zxvf yakuake.tar.gz<br />
yakuake/<br />
yakuake/README<br />
yakuake/doinst.sh<br />
yakuake/slack-desc<br />
yakuake/yakuake.SlackBuild<br />
yakuake/yakuake.info</p></blockquote>
<p>Seguimos, moviendo el source de yakuake dentro del SlackBuild:</p>
<blockquote><p>bash-3.1$ mv yakuake-2.8.1.tar.bz2 ./yakuake; cd ./yakuake</p></blockquote>
<p>Corremos el SlackBuilds (puede haber casos en los que se necesite hacer esto como root). Tambien constatar que el fichero tiene permisos de ejecucion:</p>
<blockquote><p>bash-3.1$ ls -l ./yakuake.SlackBuild<br />
-rwxr-xr-x 1 lain users 1616 2008-03-28 21:07 ./yakuake.SlackBuild<br />
bash-3.1$ ./yakuake.SlackBuild</p></blockquote>
<p>Terminado el proceso de compilacion, nos encontramos en el directorio /tmp con nuestro paqute *.tgz</p>
<blockquote><p>bash-3.1$ find /tmp/yakuake*<br />
/tmp/yakuake-2.8.1-i486-1_SBo.tgz</p></blockquote>
<p>Ahora lo podemos instalar normalemente como root con pkgtool:</p>
<blockquote><p>bash-3.1# installpkg /tmp/yakuake-2.8.1-i486-1_SBo.tgz</p></blockquote>
<p>De esta manera podemos controlar los paqutes de nuestro sistema con pkgtool, resolviendo el problema de mantenimiento de versiones instaladas, paquetes instalados, etc! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Adjunto el codigo de los dos scripts utilizados. Los mismos simplemente ejecutan gpg con los argumentos necesario y el proposito de dichos scripts es el que no podia recordar dichos parametros <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  &#8230; Si les sirve, aqui los tienen.</p>
<p>gpg-verify.py<br />
<code><br />
#!/usr/bin/env python<br />
# gpg-verify.py</p>
<p>import os<br />
import sys</p>
<p>if len(sys.argv) != 3:<br />
    print 'Usage: gpg-verify.py  '<br />
    sys.exit(1)</p>
<p>p = '--verify'<br />
p1 = sys.argv[1]<br />
p2 = sys.argv[2]</p>
<p>print 'Verifying ' + p2 + ' with ' + p1 + '...\n'</p>
<p>(child_stdin,child_stdout) = os.popen4(cmd = 'gpg %s %s %s' % (p, p1, p2))</p>
<p>for i in child_stdout.readlines():<br />
    print i,</p>
<p>print '\n'<br />
</code><br />
gpg-req-key.py<br />
<code><br />
#!/usr/bin/env python</p>
<p>import os<br />
import sys</p>
<p>if len(sys.argv) != 2:<br />
    print 'Usage: gpg-key-check.py '<br />
    sys.exit(1)</p>
<p>s = 'blackhole.pca.dfn.de'<br />
p = '--keyserver %s' % s<br />
k = sys.argv[1]<br />
p1 = '--recv-keys %s' % k</p>
<p>print 'Getting ' + k + ' from ' + s + '...\n'</p>
<p>(child_stdin,child_stdout) = os.popen4(cmd = 'gpg %s %s' % (p, p1))</p>
<p>for i in child_stdout.readlines():<br />
    print i,</p>
<p>print '\n'<br />
</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ekisip.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ekisip.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=10&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/06/22/slackbuilds-en-slackware-121/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>
	</item>
		<item>
		<title>Virtualenv en Slackware 12.1</title>
		<link>http://ekisip.wordpress.com/2008/06/21/virtualenv-en-slackware-121/</link>
		<comments>http://ekisip.wordpress.com/2008/06/21/virtualenv-en-slackware-121/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 22:17:37 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Slackware]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=8</guid>
		<description><![CDATA[Dedicado a Katai ^.^&#8221;
Teniendo Python 2.4 instalado, vamos a proceder a realizar un virtualenv:
Virtual Python Environment builder:
virtualenv is a successor to workingenv, and an extension of virtual-python.
What it Does?:
virtualenv is a tool to create isolated Python environments.
A lo bestia, digamos que virtualenv es un &#8216;chroot&#8217; de la instancia python que vamos a utilizar para trabajar. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=8&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Dedicado a Katai ^.^&#8221;</p>
<p>Teniendo Python 2.4 instalado, vamos a proceder a realizar un virtualenv:</p>
<blockquote><p>Virtual Python Environment builder:<br />
virtualenv is a successor to workingenv, and <strong>an extension of virtual-python</strong>.<br />
What it Does?:<br />
virtualenv is a tool to create <strong>isolated Python environments</strong>.</p></blockquote>
<p>A lo bestia, digamos que virtualenv es un &#8216;chroot&#8217; de la instancia python que vamos a utilizar para trabajar. Mas data <a href="http://pypi.python.org/pypi/virtualenv#what-it-does">Aqui</a></p>
<p>Creando un Python &#8216;Virtual&#8217;:<br />
Si estas en un sistema Linux, BSD, Cygwin o algun otro de OS de tipo UNIX y no tienes acceso de root, puedes crear tu propia instalacion &#8216;virtual&#8217; de python, cual utiliza sus propias librerias y enlaza algunas otras con las librerias de python del sistema.</p>
<p>Proseguimos descargando virtual-python.py:</p>
<blockquote><p>bash-3.1$ wget http://peak.telecommunity.com/dist/virtual-python.py </p></blockquote>
<p>Lo instalamos:</p>
<blockquote><p>
bash-3.1$ mkdir ~/.vpython<br />
bash-3.1$ python2.4 virtual-python.py &#8211;help<br />
usage: virtual-python.py [options]</p>
<p>options:<br />
  -h, &#8211;help          show this help message and exit<br />
  -v, &#8211;verbose       Increase verbosity<br />
  &#8211;prefix=PREFIX     The base directory to install to (default ~)<br />
  &#8211;clear             Clear out the non-root install and start from scratch<br />
  &#8211;no-site-packages  Don&#8217;t copy the contents of the global site-packages dir<br />
                      to the non-root site-packages</p>
<p>bash-3.1$ python2.4 ./virtual-python.py &#8211;prefix=/home/lain/.vpython<br />
Creating /home/lain/.vpython/lib/python2.4<br />
Creating /home/lain/.vpython/lib/python2.4/site-packages<br />
Creating /home/lain/.vpython/include/python2.4<br />
Creating /home/lain/.vpython/bin<br />
Copying /usr/local/bin/python2.4 to /home/lain/.vpython/bin<strong><br />
You&#8217;re now ready to download ez_setup.py, and run<br />
/home/lain/.vpython/bin/python ez_setup.py</strong><br />
bash-3.1$</p></blockquote>
<p>Ok, vamos a correr ez_setup.py (easy_install) mas datos <a href="http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install">Aqui</a></p>
<blockquote><p>bash-3.1$ /home/lain/.vpython/bin/python ez_setup.py<br />
Downloading http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c8-py2.4.egg<br />
Processing setuptools-0.6c8-py2.4.egg<br />
creating /home/lain/.vpython/lib/python2.4/site-packages/setuptools-0.6c8-py2.4.egg<br />
Extracting setuptools-0.6c8-py2.4.egg to /home/lain/.vpython/lib/python2.4/site-packages<br />
Adding setuptools 0.6c8 to easy-install.pth file<br />
Installing easy_install script to /home/lain/.vpython/bin<br />
Installing easy_install-2.4 script to /home/lain/.vpython/bin</p>
<p>Installed /home/lain/.vpython/lib/python2.4/site-packages/setuptools-0.6c8-py2.4.egg<br />
Processing dependencies for setuptools==0.6c8<br />
Finished processing dependencies for setuptools==0.6c8</p></blockquote>
<p>Proseguimos con nuestra meta, estamos en condiciones de instalar virtualenv!</p>
<blockquote><p>
bash-3.1$ ~/.vpython/bin/easy_install-2.4 virtualenv<br />
Searching for virtualenv<br />
Best match: virtualenv 1.1<br />
Processing virtualenv-1.1-py2.4.egg<br />
virtualenv 1.1 is already the active version in easy-install.pth<br />
Installing virtualenv script to /home/lain/.vpython/bin</p>
<p>Using /home/lain/.vpython/lib/python2.4/site-packages/virtualenv-1.1-py2.4.egg<br />
Processing dependencies for virtualenv<br />
Finished processing dependencies for virtualenv<br />
bash-3.1$</p></blockquote>
<p>Ahora a crear nuestro python environment!</p>
<blockquote><p>
bash-3.1$ mkdir ~/.pyenv<br />
bash-3.1$ ~/.vpython/bin/virtualenv ~/.pyenv<br />
New python executable in /home/lain/.pyenv/bin/python<br />
Installing setuptools&#8230;&#8230;&#8230;&#8230;.done.
</p></blockquote>
<p>Voila! terminamos <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>
bash-3.1$ ~/.pyenv/bin/python<br />
Python 2.4.4 (#1, Jun 15 2008, 17:41:52)<br />
[GCC 4.2.3] on linux2<br />
Type &#8220;help&#8221;, &#8220;copyright&#8221;, &#8220;credits&#8221; or &#8220;license&#8221; for more information.<br />
&gt;&gt;&gt;
</p></blockquote>
<p>El sabor de la victoria! ^.^&#8221;<br />
Ahora podemos crear tantos pyenv como queramos en nuestro sistema y utilizar cada uno independientemente en nuestros proyectos <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>pd: bue &#8230; tmb dedicado a dergerk &#8230; derberk &#8230; derrr &#8230; dererk ~.~&#8221;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ekisip.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ekisip.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=8&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/06/21/virtualenv-en-slackware-121/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>
	</item>
		<item>
		<title>Instalando Python 2.4 en Slackware 12.1</title>
		<link>http://ekisip.wordpress.com/2008/06/21/instalando-python-24-en-slackware-121/</link>
		<comments>http://ekisip.wordpress.com/2008/06/21/instalando-python-24-en-slackware-121/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 21:09:43 +0000</pubDate>
		<dc:creator>ekisip</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Slackware]]></category>

		<guid isPermaLink="false">http://ekisip.wordpress.com/?p=6</guid>
		<description><![CDATA[La version de Python en Salckware 12.1 es Python 2.5.2 (r252:60911, Mar  1 2008, 13:52:45).
Para instalar la version 2.4 que necesitamos para Zope procedemos de la siguiente manera:
Primero bajamos el source de Python desde el sitio oficial de python
bash-3.1$ wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tar.bz2
Desempaquetamos:
bash-3.1$ tar jxvf Python-2.4.4.tar.bz2
Cambiamos al directorio desempaquetado:
bash-3.1$ cd Python-2.4.4
Corremos el configure:
bash-3.1$ ./configure
Compilamos, notese el [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=6&subd=ekisip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>La version de Python en Salckware 12.1 es Python 2.5.2 (r252:60911, Mar  1 2008, 13:52:45).<br />
Para instalar la version 2.4 que necesitamos para Zope procedemos de la siguiente manera:</p>
<p>Primero bajamos el source de Python desde el sitio oficial de python</p>
<blockquote><p>bash-3.1$ wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tar.bz2</p></blockquote>
<p>Desempaquetamos:</p>
<blockquote><p>bash-3.1$ tar jxvf Python-2.4.4.tar.bz2</p></blockquote>
<p>Cambiamos al directorio desempaquetado:</p>
<blockquote><p>bash-3.1$ cd Python-2.4.4</p></blockquote>
<p>Corremos el configure:</p>
<blockquote><p>bash-3.1$ ./configure</p></blockquote>
<p>Compilamos, notese el parametro -j :</p>
<blockquote><p>       -j [jobs], &#8211;jobs[=jobs]<br />
            Specifies  the number of jobs (commands) to run simultaneously.  If there is more than one -j option, the last one is effective.  If the -j option is given<br />
            without an argument, make will not limit the number of jobs that can run simultaneously.</p></blockquote>
<p>En mi caso:</p>
<blockquote><p>bash-3.1$ make -j3 </p></blockquote>
<p>Instalamos ( como root ):</p>
<blockquote><p>bash-3.1$ make install</p></blockquote>
<p>Eso es todo, ahora ejecutamos :</p>
<blockquote><p>bash-3.1$ python2.4 </p></blockquote>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ekisip.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ekisip.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ekisip.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ekisip.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ekisip.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ekisip.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ekisip.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ekisip.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ekisip.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ekisip.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ekisip.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ekisip.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ekisip.wordpress.com&blog=4021737&post=6&subd=ekisip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ekisip.wordpress.com/2008/06/21/instalando-python-24-en-slackware-121/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3633a85899c3721fa726034d62f690b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ekisip</media:title>
		</media:content>
	</item>
	</channel>
</rss>