distutils `requires' tag
Hi, I'm using python 2.3.5 and want to use distutils to distribute a
module that depends on another - is there any way to specify that?
Something like:
setup(name='aimspy',
...
requires = { 'jpype': '*'},
)
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Re: distutils `requires' tag
Diez B. Roggisch wrote: > jimburton schrieb: > > Hi, I'm using python 2.3.5 and want to use distutils to distribute a > > module that depends on another - is there any way to specify that? > > Use setuptools. It can do such a thing. > > Diez Many thanks. -- http://mail.python.org/mailman/listinfo/python-list
Organising unit tests
I have a number of unit tests organised hierarchically, all of which inherit fixtures from a base class. To run these all at once I started out using from basic import map, directionalpan, layerorder, layervisibility, listlayers, streamlayerlist # ... lots more ... suite0 = unittest.TestLoader().loadTestsFromTestCase(directionalpan.TestPan) suite1 = unittest.TestLoader().loadTestsFromTestCase(layerorder.TestLayerorder) # ... lots more ... alltests = unittest.TestSuite([suite0 , suite1 ]) unittest.TextTestRunner(verbosity=2).run(alltests) Which is unmaintainable. the TestLoader docs warn that loadTestsFromModule will not play nicely with my situation and indeed if I try suite0 = unittest.TestLoader().loadTestsFromModule(basic) then run the tests, it hasn't picked any up. I suppose I could collect and run the tests with a shell script...what are my options here to avoid hardcoding and maintaining the list of tests, and how is it normally done? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: File I/O
Kirt wrote: > Hi! I need some help in file I/O > > I have an xml file.. [snip] See http://diveintopython.org/xml_processing/ -- http://mail.python.org/mailman/listinfo/python-list
Re: File I/O
Kirt wrote:
> i dont wanna parse the xml file..
>
> Just open the file as:
>
> f=open('test.xml','a')
>
> and append a line "abc" before tag
Use a regex to split the contents and insert new stuff, eg
import re
prog = prog = re.compile('^(.*)()', re.DOTALL)
m = prog.search(f.read())
then m.group(1) is everything before and m.group(2) is .
Put them together with your new tag and write it back to the file
--
http://mail.python.org/mailman/listinfo/python-list
Re: Organising unit tests
OK, so I'm trying to collect the tests with python and add them to the
test suite dynamically, but I have a problem with module names. Here's
what I've got:
#
import os
from os.path import join
import unittest
alltests = unittest.TestSuite()
def mightBeATest(f):
#TODO check whether it really is a test
return f.endswith('.py') and f != '__init__.py'
def isModule(d):
if not os.path.isdir(d):
return False
for f in os.listdir(d):
if f == '__init__.py':
return True
return False
def getTestsFromDir(dir, currentmod):
for f in os.listdir(dir):
if not f.startswith('.'):
if isModule(f):
#TODO how to check whether we are several modules in?
mod = __import__(f)
getTestsFromDir(os.path.join(dir, f), mod)
elif mightBeATest(os.path.join(dir, f)):
fname, etx = os.path.splitext(f)
print 'adding test
with',('alltests.addTests(unittest.TestLoader().loadTestsFromTestCase('+(currentmod.__dict__[fname])+'))')
eval('alltests.addTests(unittest.TestLoader().loadTestsFromTestCase('+currentmod.__dict__[fname]+'))')
getTestsFromDir(os.curdir, None)
print alltests.countTestCases()
it's importing and referring to the current module that I have a
problem with...it gives me a key error.
--
http://mail.python.org/mailman/listinfo/python-list
Re: File I/O
Diez B. Roggisch wrote: > Kirt wrote: > > > > > jimburton wrote: > >> Kirt wrote: > >> > Hi! I need some help in file I/O > >> > > >> > I have an xml file.. > >> [snip] > >> See http://diveintopython.org/xml_processing/ > > > > i dont wanna parse the xml file.. > > If you play soccer, do you insist on playing with a baseball bat? > I've been known to open a bottle of wine with a pencil. Works fine. -- http://mail.python.org/mailman/listinfo/python-list
problem getting started with pyDB2
Hi, I'm using python 2.4, DB2 8.1 (with development libraries) on
ubuntu linux 5.10. I installed PyDB2 1.1 but when I try to connect to
any database I've got this:
>>> import DB2
>>> conn = DB2.connect(dsn='sample', uid='db2inst1', pwd='secret')
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/site-packages/DB2.py", line 271, in __init__
self._db = _db2.connect(*args, **kwargs)
_db2.DatabaseError: ('I', -1, 'Invalid Handle')
>>>
After installing pydb2 I got errors about the missing file libdb2.so.1
so I copied this file from /opt/IBM/db2/V8.1/lib into /usr/lib - am I
now missing other libs? If so how do I let python know about the db2
libs?
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Re: Zope Guru...
The Zope book is a good starting point - http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/view -- http://mail.python.org/mailman/listinfo/python-list
