26 |
26 |
27 <target name="unittest" depends="pt,pt-coverage"/> |
27 <target name="unittest" depends="pt,pt-coverage"/> |
28 |
28 |
29 <target name="pt"> |
29 <target name="pt"> |
30 <pathconvert pathsep=":" property="python.path"> |
30 <pathconvert pathsep=":" property="python.path"> |
31 <fileset dir="${python.builder.dir}/lib" includes="**/*.egg" excludes="jython*"/> |
31 <fileset dir="${python.builder.dir}/lib" includes="*.egg" excludes="jython*"/> |
32 <fileset dir="${lib.dir}" includes="**/*.egg"/> |
32 <fileset dir="${lib.dir}" includes="zipsafe/*.egg" /> |
33 <dirset dir="${lib.dir}"/> |
33 <dirset dir="${lib.dir}" includes="zipnotsafe/*.egg" /> |
34 <fileset dir="${module.bin.dir}" includes="**/${ant.project.name}*.egg"/> |
34 <dirset dir="${lib.dir}/zipsafe" /> |
35 <dirset dir="${basedir}/lib"/> |
35 <!--<fileset dir="${module.bin.dir}" includes="${ant.project.name}*.egg"/>--> |
|
36 <dirset dir="${basedir}" includes="lib"/> |
36 </pathconvert> |
37 </pathconvert> |
37 <pathconvert pathsep=" " property="python.modules.coverage"> |
38 <pathconvert pathsep=" " property="python.modules.coverage"> |
38 <fileset dir="${basedir}" includes="**/*.py"/> |
39 <fileset dir="${basedir}" includes="**/*.py"/> |
39 </pathconvert> |
40 </pathconvert> |
40 <!----> |
41 <!----> |
53 <script language="jython" setbeans="false"> |
54 <script language="jython" setbeans="false"> |
54 <![CDATA[ |
55 <![CDATA[ |
55 import sys |
56 import sys |
56 import os |
57 import os |
57 import shutil |
58 import shutil |
|
59 |
58 for p in project.getProperty('python.path').split(':'): |
60 for p in project.getProperty('python.path').split(':'): |
59 if 'amara' not in p: |
61 sys.path.append(p) |
60 sys.path.append(p) |
62 |
61 os.chdir(project.getProperty('lib.dir')) |
63 os.chdir(project.getProperty('lib.dir')) |
62 if os.path.exists('build'): |
64 if os.path.exists('build'): |
63 shutil.rmtree('build') |
65 shutil.rmtree('build') |
64 import nose |
66 import nose |
65 args = project.getProperty('nose.args') |
67 args = project.getProperty('nose.args') |
66 args2 = "--with-xunit --xunit-file=" + project.getProperty('junit.result.dir') + "/jython.xml" + args |
68 args2 = "--with-xunit --xunit-file=" + project.getProperty('junit.result.dir') + "/jython.xml" + args |
67 testdir = os.path.join(project.getProperty('basedir'), 'lib', project.getProperty('ant.project.name')) |
69 testdir = os.path.join(project.getProperty('basedir'), 'lib', project.getProperty('ant.project.name')) |
68 |
70 |
69 result = True |
71 result = True |
70 if ' ' in args: |
72 if ' ' in args: |
71 result = nose.run(argv=['-v', testdir + 'tests']) |
73 argv = ['-v', testdir + 'tests'] |
|
74 result = nose.run(argv=argv) |
72 elif 'cpython' not in args: |
75 elif 'cpython' not in args: |
73 result = nose.run(argv=['-v', args2]) |
76 argv = ['-v', args2] |
|
77 result = nose.run(argv=argv) |
74 print >> sys.stderr |
78 print >> sys.stderr |
75 if not result: |
79 if not result: |
76 raise Exception('Jython unittest failure.') |
80 raise Exception('Jython unittest failure.') |
77 ]]> |
81 ]]> |
78 </script> |
82 </script> |