summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2010-01-02 23:13:03 +0000
committerBob Ippolito <bob@redivi.com>2010-01-02 23:13:03 +0000
commit6c2159234ce5a534b996bbf3ecd5295b87fcb58e (patch)
tree645eb5c33fee9c35c5486afd052d7398ab6363ba
parent2219053938529df211440e2b5758bc6ecaf17062 (diff)
downloadxattr-6c2159234ce5a534b996bbf3ecd5295b87fcb58e.tar.gz
experimental solaris support, test suite, move dirs around
-rw-r--r--setup.py3
-rw-r--r--xattr/__init__.py (renamed from Lib/xattr/__init__.py)0
-rw-r--r--xattr/_xattr.c (renamed from Modules/xattr/_xattr.c)0
-rw-r--r--xattr/constants.py (renamed from Lib/xattr/constants.py)0
-rw-r--r--xattr/tests/__init__.py21
-rw-r--r--xattr/tests/test_xattr.py42
-rwxr-xr-xxattr/tool.py (renamed from Lib/xattr/tool.py)0
7 files changed, 64 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index a0bffec..8ee78c7 100644
--- a/setup.py
+++ b/setup.py
@@ -41,9 +41,8 @@ setup(
license="MIT License",
packages=['xattr'],
platforms=['MacOS X', 'Linux', 'FreeBSD'],
- package_dir={'xattr': 'Lib/xattr'},
ext_modules=[
- Extension("xattr._xattr", ["Modules/xattr/_xattr.c"]),
+ Extension("xattr._xattr", ["xattr/_xattr.c"]),
],
entry_points={
'console_scripts': [
diff --git a/Lib/xattr/__init__.py b/xattr/__init__.py
index 3a85acf..3a85acf 100644
--- a/Lib/xattr/__init__.py
+++ b/xattr/__init__.py
diff --git a/Modules/xattr/_xattr.c b/xattr/_xattr.c
index 59ee0b1..59ee0b1 100644
--- a/Modules/xattr/_xattr.c
+++ b/xattr/_xattr.c
diff --git a/Lib/xattr/constants.py b/xattr/constants.py
index 8ee1c3b..8ee1c3b 100644
--- a/Lib/xattr/constants.py
+++ b/xattr/constants.py
diff --git a/xattr/tests/__init__.py b/xattr/tests/__init__.py
new file mode 100644
index 0000000..2391ae6
--- /dev/null
+++ b/xattr/tests/__init__.py
@@ -0,0 +1,21 @@
+import unittest
+
+
+def all_tests_suite():
+ suite = unittest.TestLoader().loadTestsFromNames([
+ 'xattr.tests.test_xattr',
+ ])
+ return suite
+
+
+def main():
+ runner = unittest.TextTestRunner()
+ suite = all_tests_suite()
+ runner.run(suite)
+
+
+if __name__ == '__main__':
+ import os
+ import sys
+ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+ main() \ No newline at end of file
diff --git a/xattr/tests/test_xattr.py b/xattr/tests/test_xattr.py
new file mode 100644
index 0000000..8c6c467
--- /dev/null
+++ b/xattr/tests/test_xattr.py
@@ -0,0 +1,42 @@
+import os
+from unittest import TestCase
+from tempfile import mkstemp, mkdtemp
+
+import xattr
+
+class TestFile(TestCase):
+ def setUp(self):
+ self.tempfh, self.tempfile = mkstemp()
+
+ def tearDown(self):
+ os.close(self.tempfh)
+ os.unlink(self.tempfile)
+
+ def testAttr(self):
+ x = xattr.xattr(self.tempfile)
+ self.assertEqual(x.keys(), [])
+ self.assertEqual(dict(x), {})
+
+ x['sopal'] = 'foo'
+ x['sop.foo'] = 'bar'
+ del x
+
+ x = xattr.xattr(self.tempfile)
+ self.assertTrue('sopal' in x)
+ self.assertEqual(x['sopal'], 'foo')
+ self.assertTrue('sop.foo' in x)
+ self.assertEqual(x['sop.foo'], 'bar')
+
+ del x['sop.foo']
+ del x
+
+ x = xattr.xattr(self.tempfile)
+ self.assertTrue('sop.foo' not in x)
+
+
+class TestDir(TestFile):
+ def setUp(self):
+ self.tempfile = mkdtemp()
+
+ def tearDown(self):
+ os.rmdir(self.tempfile) \ No newline at end of file
diff --git a/Lib/xattr/tool.py b/xattr/tool.py
index 3b1121e..3b1121e 100755
--- a/Lib/xattr/tool.py
+++ b/xattr/tool.py