Python 2.4 Tix failing on Windows XP

2004-12-09 Thread j vickroy
Hello,

I've just installed (accepted all installation defaults) Python 2.4 (final) 
on my Microsoft Windows XP (home edition - service pack 2) computer, and I 
am experiencing the following behavior regarding Tix:

>>> import sys
>>> sys.version
'2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)]'
>>> import Tix
>>> root = Tix.Tk()
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\Python24\lib\lib-tk\Tix.py", line 210, in __init__
self.tk.eval('package require Tix')
TclError: couldn't load library "tix8184.dll": this library or a dependent 
library could not be found in library path
>>> import os
>>> os.environ['TIX_LIBRARY']
'C:\\Python24\\tcl\\tix8.1'
>>>


"tix8184.dll" is definitely not in the 'C:\Python24\tcl\tix8.1' folder; its 
in the 'C:\Python24\DLLs' folder.  I placed a copy of "tix8184.dll" in  the 
'C:\Python24\tcl\tix8.1' folder, but I still get the same error.

 I next tried:

>>> os.environ['TIX_LIBRARY'] = 'C:\\Python24\\DLLs'

but I still get the same error.

Could someone tell me what I am doing incorrectly?

Thanks.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Newby] Problem with compilation.

2004-12-09 Thread j vickroy
The Python modules documentation indicates crypt is only available on Unix
platforms.

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi folks!
>
> Can't compile my file due to some problems with crypt module.
> My platform is WinXP:
> First I launch my Python Shell,
> Than I open the *.py file,
> Next I press F5 to 'run module'
> The message is:"ImportError: No module named crypt"
>
> Few lines of code for example:
>
> ...
> import posix
> import posixpath
> from crypt import *
>
> startRecord = 0
> inRecord = 1
> ...
>
> Thanks for help.
>
>


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 Tix failing on Windows XP

2004-12-09 Thread j vickroy
Ok,  that indeed did work.  Thanks for your help.


"Michael Auerswald" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Ok, problem solved, more or less. What happens is that Tcl isnt looking 
> for the Tix DLL along the python path nor is it looking along the 
> os.environ path, but instead it just checks the normal Windows path. So, 
> if your add python24\DLLs to your path the error is gone.
>
> Strangely enough the whole problem only turns up inside PythonWin, whereas 
> if I try it from the command line everything works fine.
>
> Michael 


-- 
http://mail.python.org/mailman/listinfo/python-list


how to dynamically create class methods ?

2008-03-25 Thread j vickroy
Hello,

Here is some pseudo-code that hopefully illustrates what I want to do:

records = list(...)
for record in records:
new_fcn = define_a function_for(record)
instance = my_new_class_instance()
setattr(instance, 'myfcn', new_fcn)
instance.execute() # instance.execute() calls instance.myfcn(*args)


I have looked at some of the functions in the *new* module and 
new.code(...), new.function(...), and new.instancemethod(...) appear to 
do what I want, but I do not know how to use new.code() and 
new.function() -- specifically what its *global* parameter should be.

I was not able to find helpful information using Google.

Thanks for any suggestions on how to approach this.

-- jv
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to dynamically create class methods ?

2008-03-25 Thread j vickroy
Arnaud Delobelle wrote:
> On Mar 25, 6:13 pm, j vickroy <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> Here is some pseudo-code that hopefully illustrates what I want to do:
>>
>> records = list(...)
>> for record in records:
>> new_fcn = define_a function_for(record)
>> instance = my_new_class_instance()
>> setattr(instance, 'myfcn', new_fcn)
>> instance.execute() # instance.execute() calls instance.myfcn(*args)
>>
>> I have looked at some of the functions in the *new* module and
>> new.code(...), new.function(...), and new.instancemethod(...) appear to
>> do what I want, but I do not know how to use new.code() and
>> new.function() -- specifically what its *global* parameter should be.
> 
> The best way to understand how new.function and new.code work is to
> look at the Python source.  (Objects/funcobject.c and Objects/
> codeobject.c, actual objects are defined in and Include/funcobject.h
> Include/code.h).
> 
> However, to create a function dynamically in Python it is often no
> more trouble than a def statement:
> 
> Funnily enough I can't think of a nice example ATM so here is a bad
> one: say you want to create a function that checks the spelling of a
> word, regardless of case.  You could a function that returns on-the-
> fly created functions that check the spelling of a word like this:
> 
> def get_spellchecker(word):
> word = word.upper()
> def check_spelling(candidate):
> return candidate.upper() == word
> return scheck_spelling
> 
> Then
> 
>>>> check_hypo = get_spellchecker('hypopothamus')
>>>> check_hypo('Hypopothamus')
> True
>>>> check_hypo('Big scary mammal')
> False
> 
> (Warning: this is all untested).
> 
> HTH
> 
> --
> Arnaud
> 

Thanks for your reply, Arnaud.

As per your suggestion, I tried looking at include/code.h and 
include/funcobject.h (my MS Windows distribution does not appear to 
contain .c files).  However, since I'm not a C programmer, I did not 
find the .h files all that helpful.

What I failed to make clear in my original posting is that the functions 
must be created dynamically using information in a *record* as the code 
iterates over all *records*.  So, I can not pre-define the functions and 
then simply select the desired one at run-time.

-- jv
-- 
http://mail.python.org/mailman/listinfo/python-list


py.test and test coverage analysis ?

2008-04-02 Thread j vickroy
Hello all,

I am using py.test (http://codespeak.net/py/dist/test.html) to perform 
unit testing.  I would like to include test coverage analysis using 
coverage.py (http://nedbatchelder.com/code/modules/coverage.html), but I 
do not know how to simultaneously apply the two tools in a single run.

Could someone offer a suggestion on how to combine coverage analysis 
with py.test.

Thanks,
-- jv
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: pry unit testing framework

2008-04-02 Thread j vickroy
Aldo Cortesi wrote:
> We are happy to announce the first release of Pry, a unit testing framework.
> 
> Features
> 
> 
> * Built-in coverage analysis, profiling, and quick-and-dirty benchmarking
> * Assertion-based tests - no ugly failUnless*, failIf*, etc. methods
> * Tree-based test structure for better fixture management
> * No implicit instantiation of test suits
> * Powerful command-line interface
> 
> 
> Download:  http://dev.nullcube.com
> 
> Manual: http://dev.nullcube.com/doc/pry/index.html
> 
> 
It appears this package can not be used with Microsoft Windows because 
it uses the *fcntl* module which is not part of the Windows distribution.

 >>> import sys
 >>> sys.version
'2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]'
 >>>

 >>> import libpry
Traceback (most recent call last):
   File "", line 1, in 
   File "C:\Python25\Lib\site-packages\libpry\__init__.py", line 1, in 

 from test import *
   File "C:\Python25\Lib\site-packages\libpry\test.py", line 4, in 
 import _tinytree, explain, coverage, utils
   File "C:\Python25\Lib\site-packages\libpry\coverage.py", line 3, in 

 import utils
   File "C:\Python25\lib\site-packages\libpry\utils.py", line 1, in 
 import os.path, fnmatch, struct, fcntl, termios, os
ImportError: No module named fcntl



Unfortunate, because I'm definitely interested in the code coverage and 
profiling features.

-- jv
-- 
http://mail.python.org/mailman/listinfo/python-list


distutils.core.setup --install-script option in Python 2.6 ?

2009-11-05 Thread j vickroy

Hello,

I have just upgraded from Python 2.5 to 2.6 and am unable to locate any 
trace of the --install-script option, in release 2.6.4 (MS Windows XP), 
for distutils.core.setup.  I also have been unable to locate any mention 
of it on-line.


My v2.5 setup.py scripts are failing with the falling error:

error: option --install-script not recognized

I apologize for missing something obvious here, but I am stuck.

Thanks in advance for your feedback.

-- jv
--
http://mail.python.org/mailman/listinfo/python-list


Re: Help running Windows programs from Python

2010-05-07 Thread j vickroy

Scott wrote:

I want to write a script to automate log archiving/compressing on a
Win2003 server. I have Python 2.6 installed. I am planning to use 7-
zip for compression (because I have been using it manually for a while
now). For now all operations will be local in the C: drive.

As a total beginner I'm having trouble grasping the control of
external programs.

I have found these options but have not tried any yet - I would like
some advice on which approach would be the most appropriate to begin
with.

Command Line Application Approach:
os.system
os.spawn*
os.popen*
popen2.*
commands.*
All of the above recommend replacing with subprocess module
subprocess - latest way to do command line?
pexpect module - http://sourceforge.net/projects/pexpect/, Most recent
file is dated 1/5/2008
It should work on any platform that supports the standard Python
pty  module. (Windows?)
pty - "On Windows, only sockets are supported; on Unix, all
file descriptors." (gulp, ??)

COM Application Approach:
Per the 7-zip FAQ: Use the 7z.dll or 7za.dll - I haven't found these
files yet on sf.net.
comtypes 0.6.2 - has the word COM in it?
pywin32 / win32com  - there's that word again.

And then there is this whole idea of "wrappers."

Thanks,
Scott


Hello Scott,

I did not see what version of Python you are using (3.x?, 2.x?) so I'll 
answer based on Python 2.6.4 which I am using.


If you already can accomplish your task with a series of commands, from 
a console window, my recommendation is to first read the Python 
documentation for os.system(...) which allows you to pass, as a 
parameter, any command you can type at a console window.  Then, read the 
subprocess module documentation (particularly Section "18.1.3.3. 
Replacing os.system()").  Use the subprocess module Popen(...) function 
as a replacement for os.system(...).  You may include as many calls to 
Popen(...), in your Python script, as needed.


I do not know much about 7-zip so I can not say if the above 
command-line-like approach is feasible, but a quick glance at the FAQ 
indicates it probably is.


Since you are just getting started, for simplicity, I would recommend 
against trying to use the 7-zip COM 
(http://en.wikipedia.org/wiki/Component_Object_Model) interface or the 
7z.dll (which should be in the C:\Program Files\7-Zip\ folder) directly 
via the Python ctypes module (included in Python 2.6).


HTH,
-- jv
--
http://mail.python.org/mailman/listinfo/python-list


Re: unable to get Hudson to run unit tests

2010-05-10 Thread j vickroy

Stefan Behnel wrote:

j vickroy, 07.05.2010 20:44:

I apologize if this is not the appropriate forum for a question about
Hudson (http://hudson-ci.org/), but I did not know where else to ask and
my web searches have not been fruitful.


Certainly nice to read something about Hudson in this forum, which is 
rare enough. It's seriously the greatest CI tool I've ever used, and it 
works great with Python apps.




"C:\Python26\Scripts\nosetests.exe --with-xunit --verbose"

in the *Execute Python Script* subsection.


The problem is that this isn't a "Python Script". I's a an executable, 
native program. Use the "execute shell" build step instead.


Stefan


Thanks for your reply, Stefan.

When the above command

"C:\Python26\Scripts\nosetests.exe --with-xunit --verbose"

is moved to the "Execute shell" section of the job configuration page 
along with the following "tracer" command:


#!python.exe
print 'FOOO'

their is still no indication the unit tests are run.

Here is the output from the Hudson Console Output page

---
Started by user anonymous
Updating svn://vm-svn/GOES data processing/trunk/GOES/13,14,15/SXI/level-1
At revision 3401
no change for svn://vm-svn/GOES data 
processing/trunk/GOES/13,14,15/SXI/level-1 since the previous build
[workspace] $ python.exe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson2011616575490005324.sh

FOOO
[workspace] $ cmd.exe -xe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson902246697107326581.sh

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 13-15 SXI 
Level-1 Products Generation\workspace>Recording test results

Test reports were found but none of them are new. Did tests run?
For example, C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 
13-15 SXI Level-1 Products Generation\workspace\level-1\nosetests.xml is 
2 days 19 hr old


Finished: FAILURE
---

As a side note, my Hudson "global" configuration page contains:

cmd.exe

in the "Shell executable" section and

NOSEDIR
C:\Python26\Scripts

in the "Global properties" section.

-- jv
--
http://mail.python.org/mailman/listinfo/python-list


Re: unable to get Hudson to run unit tests

2010-05-10 Thread j vickroy

Jean-Michel Pichavant wrote:

Stefan Behnel wrote:

j vickroy, 07.05.2010 20:44:

I apologize if this is not the appropriate forum for a question about
Hudson (http://hudson-ci.org/), but I did not know where else to ask and
my web searches have not been fruitful.


Certainly nice to read something about Hudson in this forum, which is 
rare enough. It's seriously the greatest CI tool I've ever used, and 
it works great with Python apps.


We use it, but this is a python list that's why there's few topics about 
it. :)
Speaking for myself,  I use it to execute the linter (pylint) on the 
code and run unitary tests. Great tool for sure.


JM



Is there a more appropriate forum to ass about Python and Hudson?  -- jv
--
http://mail.python.org/mailman/listinfo/python-list


Re: unable to get Hudson to run unit tests

2010-05-10 Thread j vickroy

Jean-Michel Pichavant wrote:

j vickroy wrote:

Stefan Behnel wrote:

j vickroy, 07.05.2010 20:44:

I apologize if this is not the appropriate forum for a question about
Hudson (http://hudson-ci.org/), but I did not know where else to ask 
and

my web searches have not been fruitful.


Certainly nice to read something about Hudson in this forum, which is 
rare enough. It's seriously the greatest CI tool I've ever used, and 
it works great with Python apps.




"C:\Python26\Scripts\nosetests.exe --with-xunit --verbose"

in the *Execute Python Script* subsection.


The problem is that this isn't a "Python Script". I's a an 
executable, native program. Use the "execute shell" build step instead.


Stefan


Thanks for your reply, Stefan.

When the above command

"C:\Python26\Scripts\nosetests.exe --with-xunit --verbose"

is moved to the "Execute shell" section of the job configuration page 
along with the following "tracer" command:


#!python.exe
print 'FOOO'

their is still no indication the unit tests are run.

Here is the output from the Hudson Console Output page

---
Started by user anonymous
Updating svn://vm-svn/GOES data 
processing/trunk/GOES/13,14,15/SXI/level-1

At revision 3401
no change for svn://vm-svn/GOES data 
processing/trunk/GOES/13,14,15/SXI/level-1 since the previous build
[workspace] $ python.exe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson2011616575490005324.sh

FOOO
[workspace] $ cmd.exe -xe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson902246697107326581.sh

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 13-15 SXI 
Level-1 Products Generation\workspace>Recording test results

Test reports were found but none of them are new. Did tests run?
For example, C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 
13-15 SXI Level-1 Products Generation\workspace\level-1\nosetests.xml 
is 2 days 19 hr old


Finished: FAILURE
---

As a side note, my Hudson "global" configuration page contains:

cmd.exe

in the "Shell executable" section and

NOSEDIR
C:\Python26\Scripts

in the "Global properties" section.

-- jv
Maybe something is missing on the machine hosting hudson, did you try to 
execute nosetests.exe on that machine ?


Hudson is running on my workstation (which also has python and nose 
installed).


I'm also confused with something, you do not provide nosetests with the 
location of your package, assuming the current directory contains that 
package (my guess).


That is correct but see below ...

Instead of printing 'FOOO', try "import os ; print os.getcwd(); print 
os.listdir(os.getcwd())" to know where you are exactly and if this dir 
contains your python package.


great suggestion !

This showed the current working directory to be one level above where I 
expected so that was definitely a problem so I changed my nose command, 
in the Hudson Job configuration Execute shell box, to be


nosetests.exe --where=level-1 --with-xunit --verbose

and saved the configuration change.

This works as expected when run from a command shell in the Hudson 
current working directory for this Hudson job.


Unfortunately, when "Hudson Build now" is performed, the Hudson Console 
output, for this job, is:



Started by user anonymous
Updating svn://vm-svn/GOES data processing/trunk/GOES/13,14,15/SXI/level-1
At revision 3403
no change for svn://vm-svn/GOES data 
processing/trunk/GOES/13,14,15/SXI/level-1 since the previous build
[workspace] $ python.exe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson5273111667332806239.sh
os.getcwd(): C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 
13-15 SXI Level-1 Products Generation\workspace

os.listdir(os.getcwd()): ['level-1']
[workspace] $ cmd.exe -xe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson991194264891924641.sh

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 13-15 SXI 
Level-1 Products Generation\workspace>Recording test results

No test report files were found. Configuration error?
Finished: FAILURE


The second [workspace] section output (above) looks like cmd.exe is 
being executed with no parameters (i.e., without the

"nosetests.exe --where=level-1 --with-xunit --verbose") parameter.

Thanks for thinking about this; I realize how difficult it is to 
remotely troubleshoot a problem like this.


-- jv



JM




--
http://mail.python.org/mailman/listinfo/python-list


Re: unable to get Hudson to run unit tests

2010-05-11 Thread j vickroy

Thanks again, Stefan.  My comments are below.

Stefan Behnel wrote:

j vickroy, 10.05.2010 17:39:

Unfortunately, when "Hudson Build now" is performed, the Hudson Console
output, for this job, is:


Started by user anonymous
Updating svn://vm-svn/GOES data 
processing/trunk/GOES/13,14,15/SXI/level-1

At revision 3403
no change for svn://vm-svn/GOES data
processing/trunk/GOES/13,14,15/SXI/level-1 since the previous build
[workspace] $ python.exe
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson5273111667332806239.sh
os.getcwd(): C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES
13-15 SXI Level-1 Products Generation\workspace
os.listdir(os.getcwd()): ['level-1']
[workspace] $ cmd.exe -xe
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson991194264891924641.sh
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 13-15 SXI
Level-1 Products Generation\workspace>Recording test results
No test report files were found. Configuration error?
Finished: FAILURE


The second [workspace] section output (above) looks like cmd.exe is
being executed with no parameters (i.e., without the
"nosetests.exe --where=level-1 --with-xunit --verbose") parameter.


No, what Hudson actually does, is, it writes your command(s) into a text 
file and runs it with the system's shell interpreter (which, unless 
otherwise configured, is "cmd.exe" on Windows). 


This is not the behavior I am experiencing on my Windows XP Pro (Service 
Pack 3) workstation.


If I do not specify "C:\WINDOWS\system32\cmd.exe" for "Manage Hudson | 
Configuration System | Shell | Shell executable", the "Console output" 
after a "Build now" is:


-
Started by user anonymous
Updating svn://vm-svn/GOES data processing/trunk/GOES/13,14,15/SXI/level-1
At revision 3417
no change for svn://vm-svn/GOES data 
processing/trunk/GOES/13,14,15/SXI/level-1 since the previous build
[workspace] $ sh -xe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson869574722591302824.sh

The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "sh" (in directory "C:\Documents 
and Settings\jim.vickroy\.hudson\jobs\GOES 13-15 SXI Level-1 Products 
Generation\workspace"): CreateProcess error=2, The system cannot find 
the file specified

at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.(Proc.java:149)
at hudson.Proc$LocalProc.(Proc.java:121)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:636)
at hudson.Launcher$ProcStarter.start(Launcher.java:271)
at hudson.Launcher$ProcStarter.join(Launcher.java:278)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:83)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
	at 
hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:584)

at hudson.model.Build$RunnerImpl.build(Build.java:174)
at hudson.model.Build$RunnerImpl.doRun(Build.java:138)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416)
at hudson.model.Run.run(Run.java:1244)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot 
find the file specified

at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 17 more
Recording test results
Finished: FAILURE
-

Note Hudson is looking for "sh".

This assures the highest
possible compatibility with the executed script. You can even use the 
shebang in Hudson's scripts that way, so that you can execute scripts in 
basically any scripting language.


The likely reason why it doesn't find your test results is that you 
didn't tell it where to look. 


Actually, Hudson is not finding the tests results because they are not 
being generated.  There is no "nosetests.xml" file anywhere on my hard 
drive (except in the Recycle Bin from my explicit executions of the 
"nosetests.exe --where=level-1 --with-xunit --verbose" command).  This 
is why I thought Hudson was not executing the above nosetests.exe 
command (specified in "*job* | Configure | Build | Execute shell | command".



Put a wildcard path into the unit test
config box that finds the XML files th

Re: unable to get Hudson to run unit tests

2010-05-11 Thread j vickroy

Stefan Behnel wrote:

j vickroy, 11.05.2010 16:46:
 > Stefan Behnel wrote:

No, what Hudson actually does, is, it writes your command(s) into a
text file and runs it with the system's shell interpreter (which,
unless otherwise configured, is "cmd.exe" on Windows).


This is not the behavior I am experiencing on my Windows XP Pro (Service
Pack 3) workstation.


Then setting the "Shell executable" to "cmd.exe" will do the right thing 
here.




This assures the highest
possible compatibility with the executed script. You can even use the
shebang in Hudson's scripts that way, so that you can execute scripts
in basically any scripting language.


... although the shebang isn't really supported by cmd.exe, I guess ...



The likely reason why it doesn't find your test results is that you
didn't tell it where to look.


Actually, Hudson is not finding the tests results because they are not
being generated. There is no "nosetests.xml" file anywhere on my hard
drive


That's why I told you to configure nosetest to use an specific output 
path for the unit test file.


OK, I will do this and report back.





Thanks again for your continued interest. I quickly got Hudson to
retrieve job source from our subversion repository so I thought it would
be equally easy to get Hudson to run the unit tests, but that has proven
to be difficult, and so far I do not know how to diagnose this since it
seems there is no way to prevent Hudson from immediately deleting the
temporary scripts it generates.


Which is ok, since it prints what it does during the script execution, 
and the scripts contain nothing more than what you typed in.


Yes, and I am not seeing the nosetests.exe command listed anywhere in 
the Hudson console output.  This is why I do not think Hudson is 
executing it.




Does nosetest produce an XML file when you call it manually from the 
command line? 


Yes it does.  The exact same command (specified for the Hudson job) 
works perfectly from a Windows console.


Is nosetest.exe in your PATH, so that the cmd.exe that

Hudson starts can find it?


Yes, it is.  "C:\Python26\Scripts" is in PATH and that is where 
"nosetests.exe" is.


Personally, I'd always step into the target directory before running a 
command, so I'd make the script


cd level-1
nosetest.exe ...


OK, I will try this.



Stefan


--
http://mail.python.org/mailman/listinfo/python-list


Re: unable to get Hudson to run unit tests

2010-05-11 Thread j vickroy

Stefan Behnel wrote:

j vickroy, 11.05.2010 16:46:
 > Stefan Behnel wrote:

No, what Hudson actually does, is, it writes your command(s) into a
text file and runs it with the system's shell interpreter (which,
unless otherwise configured, is "cmd.exe" on Windows).


This is not the behavior I am experiencing on my Windows XP Pro (Service
Pack 3) workstation.


Then setting the "Shell executable" to "cmd.exe" will do the right thing 
here.




This assures the highest
possible compatibility with the executed script. You can even use the
shebang in Hudson's scripts that way, so that you can execute scripts
in basically any scripting language.


... although the shebang isn't really supported by cmd.exe, I guess ...



The likely reason why it doesn't find your test results is that you
didn't tell it where to look.


Actually, Hudson is not finding the tests results because they are not
being generated. There is no "nosetests.xml" file anywhere on my hard
drive


That's why I told you to configure nosetest to use an specific output 
path for the unit test file.




Thanks again for your continued interest. I quickly got Hudson to
retrieve job source from our subversion repository so I thought it would
be equally easy to get Hudson to run the unit tests, but that has proven
to be difficult, and so far I do not know how to diagnose this since it
seems there is no way to prevent Hudson from immediately deleting the
temporary scripts it generates.


Which is ok, since it prints what it does during the script execution, 
and the scripts contain nothing more than what you typed in.


Does nosetest produce an XML file when you call it manually from the 
command line? Is nosetest.exe in your PATH, so that the cmd.exe that 
Hudson starts can find it?


Personally, I'd always step into the target directory before running a 
command, so I'd make the script


cd level-1
nosetest.exe ...

Stefan



Here are the Hudson job | Configure | Execute shell | Command inputs:

--
cd level-1
dir
nosetests.exe --with-xunit --xunit-file=nosetests.xml --verbose
--
#!python.exe
print 'FOOO'
import os ; print 'os.getcwd():',os.getcwd(); print 
'os.listdir(os.getcwd()):',os.listdir(os.getcwd())

--


and here is the Hudson Console Output:

--
Started by user anonymous
Updating svn://vm-svn/GOES data processing/trunk/GOES/13,14,15/SXI/level-1
At revision 3417
no change for svn://vm-svn/GOES data 
processing/trunk/GOES/13,14,15/SXI/level-1 since the previous build
[workspace] $ C:\WINDOWS\system32\cmd.exe -xe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson2208088016039194869.sh

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 13-15 SXI 
Level-1 Products Generation\workspace>[workspace] $ python.exe 
C:\DOCUME~1\JIM~1.VIC\LOCALS~1\Temp\hudson6398132145818001258.sh
os.getcwd(): C:\Documents and Settings\jim.vickroy\.hudson\jobs\GOES 
13-15 SXI Level-1 Products Generation\workspace

os.listdir(os.getcwd()): ['level-1']
Recording test results
No test report files were found. Configuration error?
Finished: FAILURE
--


There is no nosetests.xml file anywhere on my hard drive (except as 
previously noted in the Recycle Bin).


From the above Console Output, I see no evidence that the nosetests.exe 
command was ever executed.

--
http://mail.python.org/mailman/listinfo/python-list


Re: default argument

2010-05-11 Thread j vickroy

Back9 wrote:

Hi,

Is this grammer working in Python?

class test:
  self._value = 10
  def func(self, self._value)

When i try it, it complains about undefined self.

i don't know why.

TIA


... not exactly; try:

class Test:
   _value = 10
   def func(self):
  print id(self._value), self._value
  print id(Test._value), Test._value

t = Test()
t.func()
--
http://mail.python.org/mailman/listinfo/python-list