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.
--- 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(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: