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
210f84ba
Commit
210f84ba
authored
Jan 26, 2012
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opener fix and tests
parent
57f82b67
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletions
+33
-1
fs/opener.py
+1
-1
fs/tests/test_opener.py
+32
-0
No files found.
fs/opener.py
View file @
210f84ba
...
@@ -125,7 +125,7 @@ class _FSClosingFile(FileWrapper):
...
@@ -125,7 +125,7 @@ class _FSClosingFile(FileWrapper):
"""A file like object that closes its parent FS when closed itself"""
"""A file like object that closes its parent FS when closed itself"""
def
close
(
self
):
def
close
(
self
):
fs
=
getattr
(
self
,
'_closefs'
,
None
)
fs
=
getattr
(
self
,
'_closefs'
,
None
)
ret
=
super
(
_FSClosingFile
)
.
close
()
ret
=
super
(
_FSClosingFile
,
self
)
.
close
()
if
fs
is
not
None
:
if
fs
is
not
None
:
fs
.
close
fs
.
close
return
ret
return
ret
...
...
fs/tests/test_opener.py
0 → 100644
View file @
210f84ba
"""
fs.tests.test_opener: testcases for FS opener
"""
import
unittest
import
tempfile
import
shutil
from
fs.opener
import
opener
from
fs
import
path
class
TestOpener
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
temp_dir
=
tempfile
.
mkdtemp
(
u"fstest_opener"
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
temp_dir
)
def
testOpen
(
self
):
filename
=
path
.
join
(
self
.
temp_dir
,
'foo.txt'
)
file_object
=
opener
.
open
(
filename
,
'wb'
)
file_object
.
close
()
self
.
assertTrue
(
file_object
.
closed
)
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