components/python/xattr/patches/test.patch
changeset 1847 b43426a2f6ba
child 4894 7219201c1b0d
child 7853 87236a3c36b4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/xattr/patches/test.patch	Tue Apr 22 12:43:58 2014 -0700
@@ -0,0 +1,48 @@
+Every file on Solaris 11 and on has two extended attributes, so if we find
+them, we shouldn't fail.  Also, we don't support extended attributes on
+symlinks, so just quietly pass that test.
+
+Merged as of 0.7.6.
+
+diff --git a/xattr/tests/test_xattr.py b/xattr/tests/test_xattr.py
+--- a/xattr/tests/test_xattr.py	Mon Mar  3 10:12:24 2014
++++ b/xattr/tests/test_xattr.py	Wed Mar 26 16:29:24 2014
+@@ -1,4 +1,5 @@
+ import os
++import sys
+ from unittest import TestCase
+ from tempfile import mkdtemp, NamedTemporaryFile
+ 
+@@ -8,10 +9,19 @@
+ class BaseTestXattr(object):
+     def test_attr(self):
+         x = xattr.xattr(self.tempfile)
+-        self.assertEqual(x.keys(), [])
+-        self.assertEqual(x.list(), [])
+-        self.assertEqual(dict(x), {})
+ 
++        # Solaris 11 and forward contain system attributes (file flags) in
++        # extended attributes present on all files, so cons them up into a
++        # comparison dict.
++        d = {}
++        if sys.platform == 'sunos5' and 'SUNWattr_ro' in x:
++            d['SUNWattr_ro'] = x['SUNWattr_ro']
++            d['SUNWattr_rw'] = x['SUNWattr_rw']
++
++        self.assertEqual(x.keys(), d.keys())
++        self.assertEqual(x.list(), d.keys())
++        self.assertEqual(dict(x), d)
++
+         x['user.sopal'] = b'foo'
+         x['user.sop.foo'] = b'bar'
+         x[u'user.\N{SNOWMAN}'] = b'not a snowman'
+@@ -38,6 +48,9 @@
+         self.assertTrue('user.sop.foo' not in x)
+ 
+     def test_symlink_attrs(self):
++        # Solaris doesn't support extended attributes on symlinks
++        if sys.platform == 'sunos5':
++            return
+         symlinkPath = self.tempfilename + '.link'
+         os.symlink(self.tempfilename, symlinkPath)
+         try: