After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691355 - Tests may fail if G_FILENAME_ENCODING is not set to UTF-8
Tests may fail if G_FILENAME_ENCODING is not set to UTF-8
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
Git master
Other Linux
: Normal minor
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-01-08 17:49 UTC by Mike Gorse
Modified: 2013-01-09 09:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch. (1.19 KB, patch)
2013-01-08 17:51 UTC, Mike Gorse
needs-work Details | Review

Description Mike Gorse 2013-01-08 17:49:26 UTC
Running make check gives me the following output:
ERROR: test_filename_out (test_gi.TestFilename)
----------------------------------------------------------------------
Traceback (most recent call last):
  • File "/home/jhbuild/checkout/gnome/pygobject-python2/tests/test_gi.py", line 712 in test_filename_out
    dirname = GLib.Dir.make_tmp('testäø.XXXXXX')
  • File "/home/jhbuild/checkout/gnome/pygobject-python2/gi/types.py", line 113 in function
    return info.invoke(*args, **kwargs)
Exception: Invalid byte sequence in conversion input

The test may fail depending on the value of G_ILENAME_ENCODING.
Comment 1 Mike Gorse 2013-01-08 17:51:45 UTC
Created attachment 233000 [details] [review]
Patch.
Comment 2 Martin Pitt 2013-01-09 08:14:13 UTC
Can you confirm that this actually works for you? When I run

  G_FILENAME_ENCODING=latin1 TEST_NAMES=test_gi.TestFilename make check 

I still get failures; it seems $G_FILENAME_ENCODING is only evaluated at program start/glib initialization, and you cannot change it at runtime?

It does work if I set

  os.environ['G_FILENAME_ENCODING'] = 'UTF-8'

or

  try:
      del os.environ['G_FILENAME_ENCODING'] 
  except KeyError:
      pass


in tests/runtests.py (as you originally proposed on IRC yesterday).

Can you confirm this? If so, let's just delete the variable in runtests.py then.

Thanks!
Comment 3 Mike Gorse 2013-01-09 09:29:14 UTC
I had only tried running make check, which was working with the patch that I posted, but, if I set G_FILENAME_ENCODING to latin-1 and only run the filename tests, then I get an error.

Setting G_FILENAME_ENCODING to UTF-8 in runtests.py works for me; if I delete the key instead (or unset it before running make check), then I still get the error. Alternatively, deleting both G_UTF8_ENCODING and G_BROKEN_FILENAMES allows make check to pass (although I have no idea what locale glib is trying on my system; running locale returns "en_US.UTF-8").
Comment 4 Martin Pitt 2013-01-09 09:40:58 UTC
Thanks for testing again! So it sounds most robust to just explicitly set it to UTF-8:

http://git.gnome.org/browse/pygobject/commit/?id=c0bd060521cc1b481995648dbe286b7e2f9ecd80