Skip to content
Permalink
Browse files

Fix type annotations using typing backport

  • Loading branch information...
Vlad-Shcherbina committed Jun 29, 2018
1 parent a48c47b commit 9be44a2ab3c964d8f54923a0246371eab7333afd
Showing with 5 additions and 2 deletions.
  1. +1 −0 changelog/3635.trivial.rst
  2. +1 −0 setup.py
  3. +3 −2 src/_pytest/mark/structures.py
@@ -0,0 +1 @@
Fix type annotations on Mark using typing backport
@@ -65,6 +65,7 @@ def main():
"attrs>=17.4.0",
"more-itertools>=4.0.0",
"atomicwrites>=1.0",
"typing>=3.6.4",

This comment has been minimized.

Copy link
@asottile

asottile Jun 30, 2018

typing should only be a dependency for versions which don't have a standard library typing module.

You can do this with extras_require (supports a larger set of setuptools versions) or directly with environment markers here.

I tend to prefer the extras_require approach for compatibility reasons myself, but as long as pytest provides wheels it's less important.

The particular environment marker you'd probably want is:

typing>=3.6;python_version<3.5

This comment has been minimized.

Copy link
@asottile

asottile Jun 30, 2018

For extras_require it would look like:

    extras_require={
        ':python_version<"3.5"': ['typing>=3.6'],
    }

This comment has been minimized.

Copy link
@Vlad-Shcherbina

Vlad-Shcherbina Jun 30, 2018

Author Owner

Thank you.
Do you think that is necessary?
It is documented that installing this package for Python 3.5 and later has no effect (https://pypi.org/project/typing/), so I thought it would be simpler to use regular dependency.

This comment has been minimized.

Copy link
@asottile

asottile Jun 30, 2018

yes, if it does nothing please don't make me download it and install it :)

]
# if _PYTEST_SETUP_SKIP_PLUGGY_DEP is set, skip installing pluggy;
# used by tox.ini to test with pluggy master
@@ -3,6 +3,7 @@
from collections import namedtuple
from functools import reduce
from operator import attrgetter
from typing import Dict, List

import attr

@@ -124,9 +125,9 @@ class Mark(object):
#: name of the mark
name = attr.ib(type=str)
#: positional arguments of the mark decorator
args = attr.ib(type="List[object]")
args = attr.ib(type=List[object])
#: keyword arguments of the mark decorator
kwargs = attr.ib(type="Dict[str, object]")
kwargs = attr.ib(type=Dict[str, object])

def combined_with(self, other):
"""

0 comments on commit 9be44a2

Please sign in to comment.
You can’t perform that action at this time.