Edgewall Software

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12020 closed defect (fixed)

Test failures on OSX due to incorrect unicode normalization — at Version 2

Reported by: Ryan J Ollos Owned by:
Priority: normal Milestone: 1.0.6
Component: plugin/git Version:
Severity: normal Keywords: unit tests unicode
Cc: Branch:
Release Notes:

Fixed Git test case failures on Mac OSX.

API Changes:
Internal Changes:

Description

Issue seems to be explained in SO:9758014/121694. The test failures are:

======================================================================
FAIL: test_unicode_branches (tracopt.versioncontrol.git.tests.PyGIT.UnicodeNameTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/tracopt/versioncontrol/git/tests/PyGIT.py", line 347, in test_unicode_branches
    self.assertEqual(u'tickét10980', branches[1][0])
AssertionError: u'tick\xe9t10980' != u'ticke\u0301t10980'
- tick\xe9t10980
?     ^
+ ticke\u0301t10980
?     ^^


======================================================================
FAIL: test_unicode_tags (tracopt.versioncontrol.git.tests.PyGIT.UnicodeNameTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/tracopt/versioncontrol/git/tests/PyGIT.py", line 364, in test_unicode_tags
    self.assertEqual([u'täg-t10980', 'v0.42.1'], tags)
AssertionError: Lists differ: [u't\xe4g-t10980', 'v0.42.1'] != [u'ta\u0308g-t10980', u'v0.42....

First differing element 0:
t\xe4g-t10980
ta\u0308g-t10980

- [u't\xe4g-t10980', 'v0.42.1']
?      ^^^

+ [u'ta\u0308g-t10980', u'v0.42.1']
?     + ^^^^^           +

Change History (2)

comment:1 by Jun Omae, 9 years ago

The following patch might be a work around for that and requires git 1.7.10+. Otherwise, we could change to unicode characters which are not decomposed on Mac OS X.

  • tracopt/versioncontrol/git/tests/PyGIT.py

    diff --git a/tracopt/versioncontrol/git/tests/PyGIT.py b/tracopt/versioncontrol/git/tests/PyGIT.py
    index a7f7c3c..f6733d1 100644
    a b class UnicodeNameTestCase(unittest.TestCase, GitCommandMixin):  
    299299        self.repos_path = tempfile.mkdtemp(prefix='trac-gitrepos-')
    300300        # create git repository and master branch
    301301        self._git('init')
     302        self._git('config', 'core.precomposeunicode', 'true')  # ticket:12020
    302303        self._git('config', 'core.quotepath', 'true')  # ticket:11198
    303304        self._git('config', 'user.name', "Joé")  # passing utf-8 bytes
    304305        self._git('config', 'user.email', "joe@example.com")

in reply to:  1 comment:2 by Ryan J Ollos, 9 years ago

Component: generalplugin/git
Keywords: unit tests unicode added
Milestone: 1.0.6
Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Replying to jomae:

The following patch might be a work around for that and requires git 1.7.10+.

I'm using Git 2.3.5 and precomposeunicode defaults to true. However, it appears the setting applies only to file names, not to branch names.

Otherwise, we could change to unicode characters which are not decomposed on Mac OS X.

That's a good idea. Committed to 1.0-stable in [13961], merged to trunk in [13962].

Note: See TracTickets for help on using tickets.