Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
2b65e3ae
Commit
2b65e3ae
authored
Apr 27, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qa: make Patch work on functions
parent
823e831f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
neo/tests/__init__.py
neo/tests/__init__.py
+6
-2
No files found.
neo/tests/__init__.py
View file @
2b65e3ae
...
@@ -29,6 +29,7 @@ import MySQLdb
...
@@ -29,6 +29,7 @@ import MySQLdb
import
transaction
import
transaction
from
functools
import
wraps
from
functools
import
wraps
from
inspect
import
isclass
from
.mock
import
Mock
from
.mock
import
Mock
from
neo.lib
import
debug
,
logging
,
protocol
from
neo.lib
import
debug
,
logging
,
protocol
from
neo.lib.protocol
import
NodeTypes
,
Packets
,
UUID_NAMESPACES
from
neo.lib.protocol
import
NodeTypes
,
Packets
,
UUID_NAMESPACES
...
@@ -463,9 +464,12 @@ class Patch(object):
...
@@ -463,9 +464,12 @@ class Patch(object):
self
.
_patch
=
patch
self
.
_patch
=
patch
try
:
try
:
orig
=
patched
.
__dict__
[
name
]
orig
=
patched
.
__dict__
[
name
]
self
.
_revert
=
lambda
:
setattr
(
patched
,
name
,
orig
)
except
KeyError
:
except
KeyError
:
if
new
or
isclass
(
patched
):
self
.
_revert
=
lambda
:
delattr
(
patched
,
name
)
self
.
_revert
=
lambda
:
delattr
(
patched
,
name
)
return
orig
=
getattr
(
patched
,
name
)
self
.
_revert
=
lambda
:
setattr
(
patched
,
name
,
orig
)
def
apply
(
self
):
def
apply
(
self
):
assert
not
self
.
applied
assert
not
self
.
applied
...
...
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