[GRASS-dev] [GRASS GIS] #2875: Python testsuite failing with UnicodeDecodeError

GRASS GIS trac at osgeo.org
Thu Aug 31 05:45:07 PDT 2017


#2875: Python testsuite failing with UnicodeDecodeError
--------------------------+-------------------------
  Reporter:  marisn       |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.2.2
 Component:  Tests        |    Version:  svn-trunk
Resolution:               |   Keywords:
       CPU:  Unspecified  |   Platform:  Linux
--------------------------+-------------------------

Comment (by mlennert):

 Sorry, had forgotten about this ticket. Thanks Maris for closing the
 other.

 Coming back to the debate concerning localization of the testing suite. I
 don't think that the output of the testing suite has to be localized, but
 I actually notice that a series of tests fail because the messages from
 the tested modules, but others because the testing is based on C-locale
 output of the module (e.g. g.remove).

 I think it would be great to be able to run the entire test suite in any
 locale. This would allow more systematic testing of locale related issues
 in modules. I don't think that the outputs of the testsuite have to be
 localized, but errors arise because of the handling of module error
 messages by the testsuite:


 {{{
 python test_r_mapcalc.py


 .

 .

 .

 .



 .

 .

 .

 .

 .E
 ======================================================================
 ERROR: test_seed_required (__main__.TestRandFunction)
 Test that seed is required when rand() is used
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "test_r_mapcalc.py", line 99, in test_seed_required
     self.assertModuleFail('r.mapcalc', expression='rand_x = rand(1, 200)')
   File "/data/home/mlennert/SRC/GRASS/grass-7.2.2RC2/dist.x86_64-pc-linux-
 gnu/etc/python/grass/gunittest/case.py", line 1180, in assertModuleFail
     module.run()
   File "/data/home/mlennert/SRC/GRASS/grass-7.2.2RC2/dist.x86_64-pc-linux-
 gnu/etc/python/grass/pygrass/modules/interface/module.py", line 716, in
 run
     module=self.name, errors=stderr)
   File "/data/home/mlennert/SRC/GRASS/grass-7.2.2RC2/dist.x86_64-pc-linux-
 gnu/etc/python/grass/exceptions/__init__.py", line 71, in __init__
     msg += _(". See the following errors:\n%s") % errors
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 37:
 ordinal not in range(128)

 ----------------------------------------------------------------------
 Ran 10 tests in 0.983s
 FAILED (errors=1)
 }}}

 Running the same test with LANGUAGE=C gives me:


 {{{
 LANGUAGE=C;python test_r_mapcalc.py


 .

 .

 .

 .



 .

 .

 .

 .

 .
 ERROR: Pseudo-random number generator not seeded

 .
 ----------------------------------------------------------------------
 Ran 10 tests in 1.014s
 OK
 }}}

 IIUC, the difference comes from this:


 {{{
 LANGUAGE=fr_BE;r.mapcalc expression='rand_x = rand(1, 200)'
 ERREUR :Générateur de nombres pseudo-aléatoires sans graine
 GRASS 7.2.2RC2
 (nc_spm_08):/data/home/mlennert/SRC/GRASS/grass-7.2.2RC2/raster/r.mapcalc/testsuite
 > LANGUAGE=C;r.mapcalc expression='rand_x = rand(1, 200)'
 ERROR: Pseudo-random number generator not seeded
 }}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2875#comment:12>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list