fix: compatibility for black on Android termux system that does not support multiprocessing

This commit is contained in:
debugtalk
2020-06-28 20:45:07 +08:00
parent 1aacc28dd1
commit 48e308f8d9
3 changed files with 22 additions and 4 deletions

View File

@@ -4,13 +4,15 @@ import json
import os.path
import platform
import uuid
from multiprocessing import Queue
from typing import Dict, List, Any
import sentry_sdk
from loguru import logger
from httprunner import __version__
from httprunner import exceptions
from httprunner.models import VariablesMapping
from loguru import logger
def init_sentry_sdk():
@@ -209,3 +211,12 @@ def override_config_variables(
variables = copy.deepcopy(config_variables)
variables.update(step_new_variables)
return variables
def is_support_multiprocessing() -> bool:
try:
Queue()
return True
except (ImportError, OSError):
# system that does not support semaphores(dependency of multiprocessing), like Android termux
return False