#2365: gunittest test local input file failure
---------------------------------+------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.1.0
Component: Default | Version: svn-trunk
Keywords: gunittest,testsuite | Platform: Linux
Cpu: x86-64 |
---------------------------------+------------------------------------------
gunittest does not recognize local input files for tests when run with
grass.gunittest.main invokation.
I have added a test for r.series.interp (r61239) that requires input files
in the testsuite directory.
The unittest includes module failure tests and tests with input files.
When i run the test from the command line, everything is fine:
{{{
GRASS 7.1.svn
(LL):~/src/grass7.1/grass_trunk/raster/r.series.interp/testsuite >ls -l
-rw-rw-r-- 1 soeren soeren 40 Jul 12 11:28 infile_2.txt
-rw-rw-r-- 1 soeren soeren 4059 Jul 12 12:35 interp_test.py
-rw-rw-r-- 1 soeren soeren 41 Jul 12 11:28 outfile_1.txt
-rw-rw-r-- 1 soeren soeren 60 Jul 12 11:28 outfile_2.txt
-rw-rw-r-- 1 soeren soeren 30 Jul 12 11:28 outfile_corrupt.txt
GRASS 7.1.svn
(LL):~/src/grass7.1/grass_trunk/raster/r.series.interp/testsuite > python
interp_test.py
100%
100%
100%
.
100%
100%
100%
.
100%
100%
100%
100%
100%
100%
.
ERROR: Please specify output= or outfile=
ERROR: Please specify output= and samplingpos=
ERROR: output= and outfile= are mutually exclusive
ERROR: samplingpos= and outfile= are mutually exclusive
ERROR: Unable to open output file <mo_such_file>
ERROR: Missing point position for output map <prec_4> in file
<outfile_corrupt.txt> near line 2
.
----------------------------------------------------------------------
Ran 4 tests in 1.205s
OK
}}}
The input files are not found when i invoke the same test with the
grass.gunittest.main method:
{{{
GRASS 7.1.svn (LL):~/src/grass7.1/grass_trunk/raster/r.series.interp >
python -m grass.gunittest.main ~/grassdata LAEA_ERTS89 LAEA_ERTS89
./interp_test failed (see testreport/./interp_test/index.html)
GRASS 7.1.svn (LL):~/src/grass7.1/grass_trunk/raster/r.series.interp > cat
testreport/./interp_test/stderr.txt .FF.
FAIL: test_infile (__main__.InterpolationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/soeren/src/grass7.1/grass_trunk/raster/r.series.interp/testsuite/interp_test.py",
line 47, in test_infile
outfile="outfile_1.txt", method="linear")
File "/home/soeren/src/grass7.1/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python/grass/gunittest/case.py", line 519, in assertModule
self.fail(self._formatMessage(msg, stdmsg))
AssertionError: Running <r.series.interp> module ended with non-zero
return code (1)
Called: r.series_interp(input=['prec_1,prec_5'], datapos=[0.0, 1.0],
outfile='outfile_1.txt', method='linear')
See the folowing errors:
ERROR: Unable to open output file <outfile_1.txt>
======================================================================
FAIL: test_inoutfiles (__main__.InterpolationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/soeren/src/grass7.1/grass_trunk/raster/r.series.interp/testsuite/interp_test.py",
line 55, in test_inoutfiles
outfile="outfile_2.txt", method="linear")
File "/home/soeren/src/grass7.1/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python/grass/gunittest/case.py", line 519, in assertModule
self.fail(self._formatMessage(msg, stdmsg))
AssertionError: Running <r.series.interp> module ended with non-zero
return code (1)
Called: r.series_interp(infile='infile_2.txt', outfile='outfile_2.txt',
method='linear')
See the folowing errors:
ERROR: Unable to open input file <infile_2.txt>
----------------------------------------------------------------------
Ran 4 tests in 1.059s
FAILED (failures=2)
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2365>
GRASS GIS <http://grass.osgeo.org>