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
49e27f0a
Commit
49e27f0a
authored
May 01, 2019
by
Chris Withers
Committed by
GitHub
May 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove jython support from unittest.mock (GH#13033)
parent
db719754
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
25 deletions
+2
-25
Lib/unittest/mock.py
Lib/unittest/mock.py
+2
-9
Lib/unittest/test/testmock/testmock.py
Lib/unittest/test/testmock/testmock.py
+0
-15
Lib/unittest/test/testmock/testpatch.py
Lib/unittest/test/testmock/testpatch.py
+0
-1
No files found.
Lib/unittest/mock.py
View file @
49e27f0a
...
...
@@ -36,13 +36,6 @@ from functools import wraps, partial
_builtins
=
{
name
for
name
in
dir
(
builtins
)
if
not
name
.
startswith
(
'_'
)}
BaseExceptions
=
(
BaseException
,)
if
'java'
in
sys
.
platform
:
# jython
import
java
BaseExceptions
=
(
BaseException
,
java
.
lang
.
Throwable
)
FILTER_DIR
=
True
# Workaround for issue #12370
...
...
@@ -57,8 +50,8 @@ def _is_instance_mock(obj):
def
_is_exception
(
obj
):
return
(
isinstance
(
obj
,
BaseException
s
)
or
isinstance
(
obj
,
type
)
and
issubclass
(
obj
,
BaseException
s
)
isinstance
(
obj
,
BaseException
)
or
isinstance
(
obj
,
type
)
and
issubclass
(
obj
,
BaseException
)
)
...
...
Lib/unittest/test/testmock/testmock.py
View file @
49e27f0a
...
...
@@ -184,21 +184,6 @@ class MockTest(unittest.TestCase):
mock
.
side_effect
=
ValueError
(
'Bazinga!'
)
self
.
assertRaisesRegex
(
ValueError
,
'Bazinga!'
,
mock
)
@
unittest
.
skipUnless
(
'java'
in
sys
.
platform
,
'This test only applies to Jython'
)
def
test_java_exception_side_effect
(
self
):
import
java
mock
=
Mock
(
side_effect
=
java
.
lang
.
RuntimeException
(
"Boom!"
))
# can't use assertRaises with java exceptions
try
:
mock
(
1
,
2
,
fish
=
3
)
except
java
.
lang
.
RuntimeException
:
pass
else
:
self
.
fail
(
'java exception not raised'
)
mock
.
assert_called_with
(
1
,
2
,
fish
=
3
)
def
test_reset_mock
(
self
):
parent
=
Mock
()
...
...
Lib/unittest/test/testmock/testpatch.py
View file @
49e27f0a
...
...
@@ -1312,7 +1312,6 @@ class PatchTest(unittest.TestCase):
def
test_patch_multiple_create_mocks_different_order
(
self
):
# bug revealed by Jython!
original_f
=
Foo
.
f
original_g
=
Foo
.
g
...
...
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