|
1 Every file on Solaris 11 and on has two extended attributes, so if we find |
|
2 them, we shouldn't fail. Also, we don't support extended attributes on |
|
3 symlinks, so just quietly pass that test. |
|
4 |
|
5 Merged as of 0.7.6. |
|
6 |
|
7 diff --git a/xattr/tests/test_xattr.py b/xattr/tests/test_xattr.py |
|
8 --- a/xattr/tests/test_xattr.py Mon Mar 3 10:12:24 2014 |
|
9 +++ b/xattr/tests/test_xattr.py Wed Mar 26 16:29:24 2014 |
|
10 @@ -1,4 +1,5 @@ |
|
11 import os |
|
12 +import sys |
|
13 from unittest import TestCase |
|
14 from tempfile import mkdtemp, NamedTemporaryFile |
|
15 |
|
16 @@ -8,10 +9,19 @@ |
|
17 class BaseTestXattr(object): |
|
18 def test_attr(self): |
|
19 x = xattr.xattr(self.tempfile) |
|
20 - self.assertEqual(x.keys(), []) |
|
21 - self.assertEqual(x.list(), []) |
|
22 - self.assertEqual(dict(x), {}) |
|
23 |
|
24 + # Solaris 11 and forward contain system attributes (file flags) in |
|
25 + # extended attributes present on all files, so cons them up into a |
|
26 + # comparison dict. |
|
27 + d = {} |
|
28 + if sys.platform == 'sunos5' and 'SUNWattr_ro' in x: |
|
29 + d['SUNWattr_ro'] = x['SUNWattr_ro'] |
|
30 + d['SUNWattr_rw'] = x['SUNWattr_rw'] |
|
31 + |
|
32 + self.assertEqual(x.keys(), d.keys()) |
|
33 + self.assertEqual(x.list(), d.keys()) |
|
34 + self.assertEqual(dict(x), d) |
|
35 + |
|
36 x['user.sopal'] = b'foo' |
|
37 x['user.sop.foo'] = b'bar' |
|
38 x[u'user.\N{SNOWMAN}'] = b'not a snowman' |
|
39 @@ -38,6 +48,9 @@ |
|
40 self.assertTrue('user.sop.foo' not in x) |
|
41 |
|
42 def test_symlink_attrs(self): |
|
43 + # Solaris doesn't support extended attributes on symlinks |
|
44 + if sys.platform == 'sunos5': |
|
45 + return |
|
46 symlinkPath = self.tempfilename + '.link' |
|
47 os.symlink(self.tempfilename, symlinkPath) |
|
48 try: |