Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
4a043df9
Commit
4a043df9
authored
Jun 10, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
42780810
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+28
-28
No files found.
wcfs/wcfs_test.py
View file @
4a043df9
...
...
@@ -78,34 +78,6 @@ def teardown_function(f):
os
.
rmdir
(
testmntpt
)
# xdefer is like defer, but makes sure exception raised before deferred
# function is called is not lost.
#
# if deferred function raises exception itself - it prints previous exception to stderr.
#
# XXX xdefer is workaround for Python2 not having exception chanining (PEP 3134)
# without which, if e.g. tDB.close() raises exception, it prevents to see
# whether and which an assert in the test failed.
#
# XXX merge into defer?
def
xdefer
(
f
):
# hack - imitate as if defer called from under xdefer was called directly by caller func
fgo
=
inspect
.
currentframe
().
f_back
.
f_back
__goframe__
=
fgo
.
f_locals
[
'__goframe__'
]
_xdefer
(
f
)
def
_xdefer
(
f
):
def
_
():
# call f, but print previous exception if f raises
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
try
:
f
()
except
:
traceback
.
print_exception
(
exc_type
,
exc_value
,
exc_traceback
)
raise
defer
(
_
)
# many tests need to be run with some reasonable timeout to detect lack of wcfs
# response. with_timout and timeout provides syntatic shortcuts to do so.
def
with_timeout
(
parent
=
context
.
background
()):
# -> ctx, cancel
...
...
@@ -1339,3 +1311,31 @@ def dump_history(t):
print
(
'
\
t
%s
\
t
%s'
%
(
t
.
hat
(
dF
.
rev
),
' '
.
join
(
emitv
)))
print
()
# xdefer is like defer, but makes sure exception raised before deferred
# function is called is not lost.
#
# if deferred function raises exception itself - it prints previous exception to stderr.
#
# XXX xdefer is workaround for Python2 not having exception chanining (PEP 3134)
# without which, if e.g. tDB.close() raises exception, it prevents to see
# whether and which an assert in the test failed.
#
# XXX merge into defer?
def
xdefer
(
f
):
# hack - imitate as if defer called from under xdefer was called directly by caller func
fgo
=
inspect
.
currentframe
().
f_back
.
f_back
__goframe__
=
fgo
.
f_locals
[
'__goframe__'
]
_xdefer
(
f
)
def
_xdefer
(
f
):
def
_
():
# call f, but print previous exception if f raises
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
try
:
f
()
except
:
traceback
.
print_exception
(
exc_type
,
exc_value
,
exc_traceback
)
raise
defer
(
_
)
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