Change back to codecov (#2363)
This commit is contained in:
16
sanic/app.py
16
sanic/app.py
@@ -114,7 +114,7 @@ if TYPE_CHECKING: # no cov
|
||||
Extend = TypeVar("Extend") # type: ignore
|
||||
|
||||
|
||||
if OS_IS_WINDOWS:
|
||||
if OS_IS_WINDOWS: # no cov
|
||||
enable_windows_color_support()
|
||||
|
||||
filterwarnings("once", category=DeprecationWarning)
|
||||
@@ -1554,7 +1554,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
||||
) -> Task:
|
||||
if not isinstance(task, Future):
|
||||
prepped = cls._prep_task(task, app, loop)
|
||||
if sys.version_info < (3, 8):
|
||||
if sys.version_info < (3, 8): # no cov
|
||||
if name:
|
||||
error_logger.warning(
|
||||
"Cannot set a name for a task when using Python 3.7. "
|
||||
@@ -1598,7 +1598,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
||||
|
||||
:param task: future, couroutine or awaitable
|
||||
"""
|
||||
if name and sys.version_info == (3, 7):
|
||||
if name and sys.version_info < (3, 8): # no cov
|
||||
name = None
|
||||
error_logger.warning(
|
||||
"Cannot set a name for a task when using Python 3.7. Your "
|
||||
@@ -1626,7 +1626,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
||||
def get_task(
|
||||
self, name: str, *, raise_exception: bool = True
|
||||
) -> Optional[Task]:
|
||||
if sys.version_info < (3, 8):
|
||||
if sys.version_info < (3, 8): # no cov
|
||||
error_logger.warning(
|
||||
"This feature (get_task) is only supported on using "
|
||||
"Python 3.8+."
|
||||
@@ -1648,7 +1648,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
||||
*,
|
||||
raise_exception: bool = True,
|
||||
) -> None:
|
||||
if sys.version_info < (3, 8):
|
||||
if sys.version_info < (3, 8): # no cov
|
||||
error_logger.warning(
|
||||
"This feature (cancel_task) is only supported on using "
|
||||
"Python 3.8+."
|
||||
@@ -1660,7 +1660,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
||||
if msg:
|
||||
if sys.version_info >= (3, 9):
|
||||
args = (msg,)
|
||||
else:
|
||||
else: # no cov
|
||||
raise RuntimeError(
|
||||
"Cancelling a task with a message is only supported "
|
||||
"on Python 3.9+."
|
||||
@@ -1672,7 +1672,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
||||
...
|
||||
|
||||
def purge_tasks(self):
|
||||
if sys.version_info < (3, 8):
|
||||
if sys.version_info < (3, 8): # no cov
|
||||
error_logger.warning(
|
||||
"This feature (purge_tasks) is only supported on using "
|
||||
"Python 3.8+."
|
||||
@@ -1709,7 +1709,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
||||
|
||||
@property
|
||||
def tasks(self):
|
||||
if sys.version_info < (3, 8):
|
||||
if sys.version_info < (3, 8): # no cov
|
||||
error_logger.warning(
|
||||
"This feature (tasks) is only supported on using "
|
||||
"Python 3.8+."
|
||||
|
||||
@@ -53,14 +53,14 @@ class ErrorHandler:
|
||||
self._warn_fallback_deprecation()
|
||||
|
||||
@property
|
||||
def fallback(self):
|
||||
def fallback(self): # no cov
|
||||
# This is for backwards compat and can be removed in v22.6
|
||||
if self._fallback is _default:
|
||||
return DEFAULT_FORMAT
|
||||
return self._fallback
|
||||
|
||||
@fallback.setter
|
||||
def fallback(self, value: str):
|
||||
def fallback(self, value: str): # no cov
|
||||
self._warn_fallback_deprecation()
|
||||
if not isinstance(value, str):
|
||||
raise SanicException(
|
||||
@@ -236,7 +236,7 @@ class ErrorHandler:
|
||||
except Exception:
|
||||
try:
|
||||
url = repr(request.url)
|
||||
except AttributeError:
|
||||
except AttributeError: # no cov
|
||||
url = "unknown"
|
||||
response_message = (
|
||||
"Exception raised in exception handler " '"%s" for uri: %s'
|
||||
@@ -281,7 +281,7 @@ class ErrorHandler:
|
||||
if quiet is False or noisy is True:
|
||||
try:
|
||||
url = repr(request.url)
|
||||
except AttributeError:
|
||||
except AttributeError: # no cov
|
||||
url = "unknown"
|
||||
|
||||
error_logger.exception(
|
||||
|
||||
12
sanic/log.py
12
sanic/log.py
@@ -6,7 +6,7 @@ from typing import Any, Dict
|
||||
from warnings import warn
|
||||
|
||||
|
||||
LOGGING_CONFIG_DEFAULTS: Dict[str, Any] = dict(
|
||||
LOGGING_CONFIG_DEFAULTS: Dict[str, Any] = dict( # no cov
|
||||
version=1,
|
||||
disable_existing_loggers=False,
|
||||
loggers={
|
||||
@@ -57,7 +57,7 @@ LOGGING_CONFIG_DEFAULTS: Dict[str, Any] = dict(
|
||||
)
|
||||
|
||||
|
||||
class Colors(str, Enum):
|
||||
class Colors(str, Enum): # no cov
|
||||
END = "\033[0m"
|
||||
BLUE = "\033[01;34m"
|
||||
GREEN = "\033[01;32m"
|
||||
@@ -65,23 +65,23 @@ class Colors(str, Enum):
|
||||
RED = "\033[01;31m"
|
||||
|
||||
|
||||
logger = logging.getLogger("sanic.root")
|
||||
logger = logging.getLogger("sanic.root") # no cov
|
||||
"""
|
||||
General Sanic logger
|
||||
"""
|
||||
|
||||
error_logger = logging.getLogger("sanic.error")
|
||||
error_logger = logging.getLogger("sanic.error") # no cov
|
||||
"""
|
||||
Logger used by Sanic for error logging
|
||||
"""
|
||||
|
||||
access_logger = logging.getLogger("sanic.access")
|
||||
access_logger = logging.getLogger("sanic.access") # no cov
|
||||
"""
|
||||
Logger used by Sanic for access logging
|
||||
"""
|
||||
|
||||
|
||||
def deprecation(message: str, version: float):
|
||||
def deprecation(message: str, version: float): # no cov
|
||||
version_info = f"[DEPRECATION v{version}] "
|
||||
if sys.stdout.isatty():
|
||||
version_info = f"{Colors.RED}{version_info}"
|
||||
|
||||
@@ -13,7 +13,7 @@ ASGISend = Callable[[ASGIMessage], Awaitable[None]]
|
||||
ASGIReceive = Callable[[], Awaitable[ASGIMessage]]
|
||||
|
||||
|
||||
class MockProtocol:
|
||||
class MockProtocol: # no cov
|
||||
def __init__(self, transport: "MockTransport", loop):
|
||||
# This should be refactored when < 3.8 support is dropped
|
||||
self.transport = transport
|
||||
@@ -56,7 +56,7 @@ class MockProtocol:
|
||||
await self._not_paused.wait()
|
||||
|
||||
|
||||
class MockTransport:
|
||||
class MockTransport: # no cov
|
||||
_protocol: Optional[MockProtocol]
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -9,7 +9,7 @@ from websockets.typing import Data
|
||||
from sanic.exceptions import ServerError
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
if TYPE_CHECKING: # no cov
|
||||
from .impl import WebsocketImplProtocol
|
||||
|
||||
UTF8Decoder = codecs.getincrementaldecoder("utf-8")
|
||||
@@ -37,7 +37,7 @@ class WebsocketFrameAssembler:
|
||||
"get_id",
|
||||
"put_id",
|
||||
)
|
||||
if TYPE_CHECKING:
|
||||
if TYPE_CHECKING: # no cov
|
||||
protocol: "WebsocketImplProtocol"
|
||||
read_mutex: asyncio.Lock
|
||||
write_mutex: asyncio.Lock
|
||||
@@ -131,7 +131,7 @@ class WebsocketFrameAssembler:
|
||||
if self.paused:
|
||||
self.protocol.resume_frames()
|
||||
self.paused = False
|
||||
if not self.get_in_progress:
|
||||
if not self.get_in_progress: # no cov
|
||||
# This should be guarded against with the read_mutex,
|
||||
# exception is here as a failsafe
|
||||
raise ServerError(
|
||||
@@ -204,7 +204,7 @@ class WebsocketFrameAssembler:
|
||||
if self.paused:
|
||||
self.protocol.resume_frames()
|
||||
self.paused = False
|
||||
if not self.get_in_progress:
|
||||
if not self.get_in_progress: # no cov
|
||||
# This should be guarded against with the read_mutex,
|
||||
# exception is here as a failsafe
|
||||
raise ServerError(
|
||||
@@ -212,7 +212,7 @@ class WebsocketFrameAssembler:
|
||||
"asynchronous get was in progress."
|
||||
)
|
||||
self.get_in_progress = False
|
||||
if not self.message_complete.is_set():
|
||||
if not self.message_complete.is_set(): # no cov
|
||||
# This should be guarded against with the read_mutex,
|
||||
# exception is here as a failsafe
|
||||
raise ServerError(
|
||||
@@ -220,7 +220,7 @@ class WebsocketFrameAssembler:
|
||||
"message was complete."
|
||||
)
|
||||
self.message_complete.clear()
|
||||
if self.message_fetched.is_set():
|
||||
if self.message_fetched.is_set(): # no cov
|
||||
# This should be guarded against with the read_mutex,
|
||||
# and get_in_progress check, this exception is
|
||||
# here as a failsafe
|
||||
|
||||
Reference in New Issue
Block a user