| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c4e65e3 commit 83c9777
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,10 +10,12 @@ pycodestyle | |||
| 10 | 10 | prospector==1.2.0 # Last version of prospector with Python 2.7 support | |
| 11 | 11 | pydocstyle | |
| 12 | 12 | nose | |
| 13 | - pytest==4.6.9 # Last version of pytest with Python 2.7 support | ||
| 14 | - py==1.8.1 | ||
| 13 | + pytest < 6.0.0; python_version > '2.7' # Tests do not support pytest 6 yet. | ||
| 15 | 14 | rope | |
| 16 | 15 | flask | |
| 17 | 16 | django | |
| 18 | 17 | isort | |
| 19 | - pathlib2>=2.2.0 ; python_version<'3.6' # Python 2.7 compatibility (pytest) | ||
| 18 | + # Python 2.7 compatibility (pytest) | ||
| 19 | + pytest==4.6.9; python_version == '2.7' | ||
| 20 | + pathlib2>=2.2.0; python_version == '2.7' | ||
| 21 | + py==1.8.1; python_version == '2.7' | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Fix a test failure and warning when running test adapter tests under pytest 5 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,11 +4,11 @@ | |||
| 4 | 4 | from collections import namedtuple | |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | - class TestPath(namedtuple("TestPath", "root relfile func sub")): | ||
| 7 | + class SingleTestPath(namedtuple("TestPath", "root relfile func sub")): | ||
| 8 | 8 | """Where to find a single test.""" | |
| 9 | 9 | ||
| 10 | 10 | def __new__(cls, root, relfile, func, sub=None): | |
| 11 | - self = super(TestPath, cls).__new__( | ||
| 11 | + self = super(SingleTestPath, cls).__new__( | ||
| 12 | 12 | cls, | |
| 13 | 13 | str(root) if root else None, | |
| 14 | 14 | str(relfile) if relfile else None, | |
@@ -62,14 +62,16 @@ def __init__(self, *args, **kwargs): | |||
| 62 | 62 | raise TypeError("missing relpath") | |
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | - class TestInfo(namedtuple("TestInfo", "id name path source markers parentid kind")): | ||
| 65 | + class SingleTestInfo( | ||
| 66 | + namedtuple("TestInfo", "id name path source markers parentid kind") | ||
| 67 | + ): | ||
| 66 | 68 | """Info for a single test.""" | |
| 67 | 69 | ||
| 68 | 70 | MARKERS = ("skip", "skip-if", "expected-failure") | |
| 69 | 71 | KINDS = ("function", "doctest") | |
| 70 | 72 | ||
| 71 | 73 | def __new__(cls, id, name, path, source, markers, parentid, kind="function"): | |
| 72 | - self = super(TestInfo, cls).__new__( | ||
| 74 | + self = super(SingleTestInfo, cls).__new__( | ||
| 73 | 75 | cls, | |
| 74 | 76 | str(id) if id else None, | |
| 75 | 77 | str(name) if name else None, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,7 +99,7 @@ | |||
| 99 | 99 | import _pytest.doctest | |
| 100 | 100 | import _pytest.unittest | |
| 101 | 101 | ||
| 102 | - from ..info import TestInfo, TestPath | ||
| 102 | + from ..info import SingleTestInfo, SingleTestPath | ||
| 103 | 103 | from ..util import fix_fileid, PATH_SEP, NORMCASE | |
| 104 | 104 | ||
| 105 | 105 | ||
@@ -207,10 +207,10 @@ def parse_item( | |||
| 207 | 207 | markers.add("expected-failure") | |
| 208 | 208 | # We can add support for other markers as we need them? | |
| 209 | 209 | ||
| 210 | - test = TestInfo( | ||
| 210 | + test = SingleTestInfo( | ||
| 211 | 211 | id=nodeid, | |
| 212 | 212 | name=item.name, | |
| 213 | - path=TestPath( | ||
| 213 | + path=SingleTestPath( | ||
| 214 | 214 | root=testroot, | |
| 215 | 215 | relfile=relfile, | |
| 216 | 216 | func=testfunc, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,7 @@ | |||
| 2 | 2 | # Licensed under the MIT License. | |
| 3 | 3 | ||
| 4 | 4 | import contextlib | |
| 5 | + import io | ||
| 5 | 6 | ||
| 6 | 7 | try: | |
| 7 | 8 | from io import StringIO | |
@@ -180,7 +181,7 @@ def _replace_fd(file, target): | |||
| 180 | 181 | """ | |
| 181 | 182 | try: | |
| 182 | 183 | fd = file.fileno() | |
| 183 | - except AttributeError: | ||
| 184 | + except (AttributeError, io.UnsupportedOperation): | ||
| 184 | 185 | # `file` does not have fileno() so it's been replaced from the | |
| 185 | 186 | # default sys.stdout, etc. Return with noop. | |
| 186 | 187 | yield | |
| Back | FazBrowse Home | New Git URL |
0 commit comments