Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
974ea2b2
Commit
974ea2b2
authored
Sep 15, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extra tests for xattrs
parent
e42c999e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
11 deletions
+16
-11
fs/__init__.py
+1
-1
fs/tests/__init__.py
+1
-0
fs/tests/test_xattr.py
+14
-10
No files found.
fs/__init__.py
View file @
974ea2b2
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
"""
"""
__version__
=
"0.2.0a
2
"
__version__
=
"0.2.0a
3
"
__author__
=
"Will McGugan (will@willmcgugan.com)"
__author__
=
"Will McGugan (will@willmcgugan.com)"
# 'base' imports * from 'path' and 'errors', so their
# 'base' imports * from 'path' and 'errors', so their
...
...
fs/tests/__init__.py
View file @
974ea2b2
...
@@ -168,6 +168,7 @@ class FSTestCases:
...
@@ -168,6 +168,7 @@ class FSTestCases:
self
.
fs
.
makedir
(
"a"
)
self
.
fs
.
makedir
(
"a"
)
self
.
assert_
(
check
(
"a"
))
self
.
assert_
(
check
(
"a"
))
self
.
fs
.
removedir
(
"a"
)
self
.
fs
.
removedir
(
"a"
)
self
.
assertRaises
(
ResourceNotFoundError
,
self
.
fs
.
removedir
,
"a"
)
self
.
assert_
(
not
check
(
"a"
))
self
.
assert_
(
not
check
(
"a"
))
self
.
fs
.
makedir
(
"a/b/c/d"
,
recursive
=
True
)
self
.
fs
.
makedir
(
"a/b/c/d"
,
recursive
=
True
)
self
.
assertRaises
(
DirectoryNotEmptyError
,
self
.
fs
.
removedir
,
"a/b"
)
self
.
assertRaises
(
DirectoryNotEmptyError
,
self
.
fs
.
removedir
,
"a/b"
)
...
...
fs/tests/test_xattr.py
View file @
974ea2b2
...
@@ -87,34 +87,38 @@ class XAttrTestCases:
...
@@ -87,34 +87,38 @@ class XAttrTestCases:
self
.
assertEquals
(
self
.
fs
.
getxattr
(
"stuff2"
,
"dirattr"
),
"a directory"
)
self
.
assertEquals
(
self
.
fs
.
getxattr
(
"stuff2"
,
"dirattr"
),
"a directory"
)
def
test_remove_file
(
self
):
def
test_remove_file
(
self
):
def
listxattrs
(
path
):
return
list
(
self
.
fs
.
listxattrs
(
path
))
# Check that xattrs aren't preserved after a file is removed
# Check that xattrs aren't preserved after a file is removed
self
.
fs
.
createfile
(
"myfile"
)
self
.
fs
.
createfile
(
"myfile"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"myfile"
),[])
self
.
assertEquals
(
listxattrs
(
"myfile"
),[])
self
.
fs
.
setxattr
(
"myfile"
,
"testattr"
,
"testvalue"
)
self
.
fs
.
setxattr
(
"myfile"
,
"testattr"
,
"testvalue"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"myfile"
),[
"testattr"
])
self
.
assertEquals
(
listxattrs
(
"myfile"
),[
"testattr"
])
self
.
fs
.
remove
(
"myfile"
)
self
.
fs
.
remove
(
"myfile"
)
self
.
assertRaises
(
ResourceNotFoundError
,
self
.
fs
.
listxattrs
,
"myfile"
)
self
.
assertRaises
(
ResourceNotFoundError
,
listxattrs
,
"myfile"
)
self
.
fs
.
createfile
(
"myfile"
)
self
.
fs
.
createfile
(
"myfile"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"myfile"
),[])
self
.
assertEquals
(
listxattrs
(
"myfile"
),[])
self
.
fs
.
setxattr
(
"myfile"
,
"testattr2"
,
"testvalue2"
)
self
.
fs
.
setxattr
(
"myfile"
,
"testattr2"
,
"testvalue2"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"myfile"
),[
"testattr2"
])
self
.
assertEquals
(
listxattrs
(
"myfile"
),[
"testattr2"
])
self
.
assertEquals
(
self
.
fs
.
getxattr
(
"myfile"
,
"testattr2"
),
"testvalue2"
)
self
.
assertEquals
(
self
.
fs
.
getxattr
(
"myfile"
,
"testattr2"
),
"testvalue2"
)
# Check that removing a file without xattrs still works
# Check that removing a file without xattrs still works
self
.
fs
.
createfile
(
"myfile2"
)
self
.
fs
.
createfile
(
"myfile2"
)
self
.
fs
.
remove
(
"myfile2"
)
self
.
fs
.
remove
(
"myfile2"
)
def
test_remove_dir
(
self
):
def
test_remove_dir
(
self
):
def
listxattrs
(
path
):
return
list
(
self
.
fs
.
listxattrs
(
path
))
# Check that xattrs aren't preserved after a dir is removed
# Check that xattrs aren't preserved after a dir is removed
self
.
fs
.
makedir
(
"mydir"
)
self
.
fs
.
makedir
(
"mydir"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"mydir"
),[])
self
.
assertEquals
(
listxattrs
(
"mydir"
),[])
self
.
fs
.
setxattr
(
"mydir"
,
"testattr"
,
"testvalue"
)
self
.
fs
.
setxattr
(
"mydir"
,
"testattr"
,
"testvalue"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"mydir"
),[
"testattr"
])
self
.
assertEquals
(
listxattrs
(
"mydir"
),[
"testattr"
])
self
.
fs
.
removedir
(
"mydir"
)
self
.
fs
.
removedir
(
"mydir"
)
self
.
assertRaises
(
ResourceNotFoundError
,
self
.
fs
.
listxattrs
,
"mydir"
)
self
.
assertRaises
(
ResourceNotFoundError
,
listxattrs
,
"mydir"
)
self
.
fs
.
makedir
(
"mydir"
)
self
.
fs
.
makedir
(
"mydir"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"mydir"
),[])
self
.
assertEquals
(
listxattrs
(
"mydir"
),[])
self
.
fs
.
setxattr
(
"mydir"
,
"testattr2"
,
"testvalue2"
)
self
.
fs
.
setxattr
(
"mydir"
,
"testattr2"
,
"testvalue2"
)
self
.
assertEquals
(
self
.
fs
.
listxattrs
(
"mydir"
),[
"testattr2"
])
self
.
assertEquals
(
listxattrs
(
"mydir"
),[
"testattr2"
])
self
.
assertEquals
(
self
.
fs
.
getxattr
(
"mydir"
,
"testattr2"
),
"testvalue2"
)
self
.
assertEquals
(
self
.
fs
.
getxattr
(
"mydir"
,
"testattr2"
),
"testvalue2"
)
# Check that removing a dir without xattrs still works
# Check that removing a dir without xattrs still works
self
.
fs
.
makedir
(
"mydir2"
)
self
.
fs
.
makedir
(
"mydir2"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment