forked from d3v-null/wp-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
36 lines (31 loc) · 832 Bytes
/
Copy path__init__.py
File metadata and controls
36 lines (31 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Test case module.
"""
from time import time
import sys
import logging
import pdb
import functools
import traceback
import copy
CURRENT_TIMESTAMP = int(time())
SHITTY_NONCE = ""
DEFAULT_ENCODING = sys.getdefaultencoding()
def debug_on(*exceptions):
if not exceptions:
exceptions = (AssertionError, )
def decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
prev_root = copy(logging.root)
try:
logging.basicConfig(level=logging.DEBUG)
return f(*args, **kwargs)
except exceptions:
info = sys.exc_info()
traceback.print_exception(*info)
pdb.post_mortem(info[2])
finally:
logging.root = prev_root
return wrapper
return decorator