From 50d0ef01ae6fada39e22e3dd65b4c0becd48388f Mon Sep 17 00:00:00 2001 From: debugtalk Date: Tue, 4 Dec 2018 14:46:30 +0800 Subject: [PATCH] fix duplicate monkey patch --- httprunner/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/httprunner/__init__.py b/httprunner/__init__.py index 6942cf6c..062b9ef9 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -2,7 +2,12 @@ try: # monkey patch at beginning to avoid RecursionError when running locust. - from gevent import monkey; monkey.patch_all() + from gevent import monkey + if not monkey.is_module_patched('socket'): + print("========== monkey patch all ==========") + monkey.patch_all() + else: + print("========== monkey patched ==========") except ImportError: pass