[Twisted-Python] Twisted Trial

Gabriel Rossetti mailing_lists at evotex.ch
Fri Jun 20 16:35:10 MDT 2008


Jake b wrote:
> On Wed, Jun 18, 2008 at 3:48 AM, Torsten A. <c2k_list at gmx.de 
> <mailto:c2k_list at gmx.de>> wrote:
>
>     Thank you all for your replies.
>
>     @Christian:
>     I should have mentioned that. The current directory is in the
>     pythonpath. In
>     the variable PYHTONPATH the dot is set and when I walk through the
>     filesystem, starting python from different locations, the current
>     path is
>     always set in sys.path. Hence, I asssume that PythonPath is set
>     correctly.
>     So your suggestion, what I thought would work
>     >  cd \original_project
>     >  trial package_to_test
>     >
>     >  cd \modified_project
>     >  trial package_to_test
>     does actually not work. Who knows why...
>
> I'm guessing this is abnormal behavior that's on WinXP only? I on 
> winXP have tried setting multiple environment variables to include a 
> project path, but imports did not work. The only way I could add a 
> path to python's import paths on winXP was to edit the registry.
I test Twisted stuff on XP to ensure it will work on inferior ;-) 
systems, and I have no problem setting PYTHONPATH. Seriously though, 
let's say my code is on the desktop (I know, not a good place, but it's 
just for testing):

C:\Documents and 
Settings\User01\Desktop\MyProject                                  <-- 
Project root, not a python package, just a directory
C:\Documents and Settings\User01\Desktop\MyProject\src                   
         <-- Source directory, not a python package, just a directory
C:\Documents and 
Settings\User01\Desktop\MyProject\src\pkg1                   <-- Root 
package
C:\Documents and 
Settings\User01\Desktop\MyProject\src\pkg1\test            <-- Root 
package's test package, this is where the unit tests for this level are
C:\Documents and 
Settings\User01\Desktop\MyProject\src\pkg1\pkg2          <-- First child 
package
C:\Documents and Settings\User01\Desktop\MyProject\src\pkg1\pkg2\test   
<-- First child package's unit tests

and so on.

Then I set my pythonPath to :

PYTHONPATH=C:\Documents and 
Settings\User01\Desktop\MyProject\src;C:\Documents and 
Settings\User01\Desktop\MyProject\src\pkg1

If I don't add the src (just a directory, not a package) AND the "root" 
package (pkg1 in my example), it doesn't work, try that maybe. I have to 
export the same thing in Linux, so it's not a Windows XP problem. It may 
be because pkg1 contains nothing except pkg2 (and an __init__.py), and 
all the interesting code is in pkg2. In reality, in my case, pgk1 is the 
company name, and pkg2 is one of the products' name, so you have to 
adapt this to your case.

 I suppose you did either reboot or reload the environment before trying 
anything, if not then it won't work. Now to run the project's code, I do 
this :

cd C:\Documents and Settings\User01\Desktop\MyProject\src
python pkg1\pkg2\my_main.py

And for trail it's the same thing (sort of, replace '\' with '.'), I'm 
going to run all of pkg's tests next :

cd C:\Documents and Settings\User01\Desktop\MyProject\src
trial pkg1.pkg2

or you can specify the test package directly, so it only runs that one :

cd C:\Documents and Settings\User01\Desktop\MyProject\src
trial pkg1.pkg2.test

or if you want to run individual tests :

cd C:\Documents and Settings\User01\Desktop\MyProject\src
trial pkg1.pkg2.test.test_module1

I hope this helps!
Gabriel
>
> If PYTHONPATH being set in windowsXP doesn't seem to have any effect 
> (Like it doesn't seem to work for me ) the only fix I found was a 
> registry edit. At the path: 
> HKLM\SOFTWARE\Python\PythonCore\2.5\PythonPath create a new key, ie: 
> 'project1', create a new value, name=(Default), 
> value='c:\data\path\to\project'
>  
>
>     I have never really used a version control system I have to admit.
>     I thought
>     of control systems to log changes which can in case of severe
>     damage or what
>     ever reason be made undone. But if I can execute different
>     versions of the
>     project, e.g. in my case the initial version and the last
>     modified, just by
>     saying run this one or that one, I am glad to use it. Can this be done
>     (excuse my probably dumb question)? Can someone please give me
>     catchword to
>     search for? As I looked briefly in the bazaar guide
>     (http://doc.bazaar-vcs.org/bzr.dev/en/user-guide/index.html) I
>     wasn't able
>     to find anything helpful.
>
> ( I don't know much about version control, it's something I'm looking 
> into. ) A term to search, maybe you're looking for is 'clone' or 
> 'branch'.
>
> If you meant to search for differnt code versioning programs, here's 
> some: Mercurial ( http://www.selenic.com/mercurial/wiki/ ), Subversion 
> ( http://subversion.tigris.org/ ), TortoiseSVN ( http://tortoisesvn.net/ )
>
> Hope that helps :P
> -- 
> Jake
> ------------------------------------------------------------------------
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>   





More information about the Twisted-Python mailing list