components/python/xattr/patches/test.patch
author Erik Trauschke <Erik.Trauschke@oracle.com>
Wed, 23 Sep 2015 14:00:51 -0700
changeset 4894 7219201c1b0d
parent 1847 b43426a2f6ba
permissions -rw-r--r--
21157026 CFFI should be updated to >1.1.0

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.

Additionally, fix comparison of lists to dict_keys in Python 3. This has been
fixed in newer versions of xattr which will be part of a future update of the
userland version of xattr.

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,9 +9,18 @@
 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(), list(d.keys()))
+        self.assertEqual(x.list(), list(d.keys()))
+        self.assertEqual(dict(x), d)
 
         x['user.sopal'] = b'foo'
         x['user.sop.foo'] = b'bar'
@@ -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: