Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bb4d3527
Commit
bb4d3527
authored
Jun 29, 2014
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test for access errors from OpenKey (closes #21871)
Patch from Vladimir Iofik.
parent
4becf85d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Lib/test/test_mimetypes.py
Lib/test/test_mimetypes.py
+17
-0
No files found.
Lib/test/test_mimetypes.py
View file @
bb4d3527
...
@@ -144,6 +144,23 @@ class Win32MimeTypesTestCase(unittest.TestCase):
...
@@ -144,6 +144,23 @@ class Win32MimeTypesTestCase(unittest.TestCase):
finally
:
finally
:
mimetypes
.
_winreg
=
_winreg
mimetypes
.
_winreg
=
_winreg
def
test_registry_read_error
(
self
):
import
_winreg
class
MockWinreg
(
object
):
def
OpenKey
(
self
,
key
,
name
):
if
key
!=
_winreg
.
HKEY_CLASSES_ROOT
:
raise
WindowsError
(
5
,
"Access is denied"
)
return
_winreg
.
OpenKey
(
key
,
name
)
def
__getattr__
(
self
,
name
):
return
getattr
(
_winreg
,
name
)
mimetypes
.
_winreg
=
MockWinreg
()
try
:
mimetypes
.
init
()
finally
:
mimetypes
.
_winreg
=
_winreg
def
test_main
():
def
test_main
():
test_support
.
run_unittest
(
MimeTypesTestCase
,
test_support
.
run_unittest
(
MimeTypesTestCase
,
Win32MimeTypesTestCase
Win32MimeTypesTestCase
...
...
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