From 547933dabaa56b3d9c244c8302252f3b638463d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 17 Jan 2022 16:06:32 +0100 Subject: [PATCH] Require typing-extensions on py<3.8 only (#269) typing.Literal is available since Python 3.8. Use it instead of requiring typing-extensions for systems that no longer have Python 3.7. --- pytest_asyncio/plugin.py | 7 ++++++- setup.cfg | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 7a7c8dd5..7abbd6bd 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -5,6 +5,7 @@ import functools import inspect import socket +import sys import warnings from typing import ( Any, @@ -24,7 +25,11 @@ ) import pytest -from typing_extensions import Literal + +if sys.version_info >= (3, 8): + from typing import Literal +else: + from typing_extensions import Literal _R = TypeVar("_R") diff --git a/setup.cfg b/setup.cfg index f05526bd..952a1dbe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,7 +39,7 @@ setup_requires = install_requires = pytest >= 6.1.0 - typing-extensions >= 4.0 + typing-extensions >= 4.0; python_version < "3.8" [options.extras_require] testing =