Merge pull request #7802 from bluetech/bump-attrs
Bump attrs requirement from >=17.4.0 to >=19.2.0
This commit is contained in:
		
						commit
						cd67c2a8cf
					
				|  | @ -79,7 +79,7 @@ jobs: | ||||||
|           - name: "ubuntu-py37" |           - name: "ubuntu-py37" | ||||||
|             python: "3.7" |             python: "3.7" | ||||||
|             os: ubuntu-latest |             os: ubuntu-latest | ||||||
|             tox_env: "py37-lsof-numpy-oldattrs-pexpect" |             tox_env: "py37-lsof-numpy-pexpect" | ||||||
|             use_coverage: true |             use_coverage: true | ||||||
|           - name: "ubuntu-py37-pluggy" |           - name: "ubuntu-py37-pluggy" | ||||||
|             python: "3.7" |             python: "3.7" | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. | ||||||
|  | @ -40,7 +40,7 @@ packages = | ||||||
|     _pytest.mark |     _pytest.mark | ||||||
|     pytest |     pytest | ||||||
| install_requires = | install_requires = | ||||||
|     attrs>=17.4.0 |     attrs>=19.2.0 | ||||||
|     iniconfig |     iniconfig | ||||||
|     packaging |     packaging | ||||||
|     pluggy>=0.12,<1.0 |     pluggy>=0.12,<1.0 | ||||||
|  |  | ||||||
|  | @ -37,7 +37,6 @@ from _pytest._code.source import Source | ||||||
| from _pytest._io import TerminalWriter | from _pytest._io import TerminalWriter | ||||||
| from _pytest._io.saferepr import safeformat | from _pytest._io.saferepr import safeformat | ||||||
| from _pytest._io.saferepr import saferepr | from _pytest._io.saferepr import saferepr | ||||||
| from _pytest.compat import ATTRS_EQ_FIELD |  | ||||||
| from _pytest.compat import final | from _pytest.compat import final | ||||||
| from _pytest.compat import get_real_func | from _pytest.compat import get_real_func | ||||||
| from _pytest.compat import overload | from _pytest.compat import overload | ||||||
|  | @ -918,7 +917,7 @@ class FormattedExcinfo: | ||||||
|         return ExceptionChainRepr(repr_chain) |         return ExceptionChainRepr(repr_chain) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class TerminalRepr: | class TerminalRepr: | ||||||
|     def __str__(self) -> str: |     def __str__(self) -> str: | ||||||
|         # FYI this is called from pytest-xdist's serialization of exception |         # FYI this is called from pytest-xdist's serialization of exception | ||||||
|  | @ -936,7 +935,7 @@ class TerminalRepr: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # This class is abstract -- only subclasses are instantiated. | # This class is abstract -- only subclasses are instantiated. | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ExceptionRepr(TerminalRepr): | class ExceptionRepr(TerminalRepr): | ||||||
|     # Provided by subclasses. |     # Provided by subclasses. | ||||||
|     reprcrash = None  # type: Optional[ReprFileLocation] |     reprcrash = None  # type: Optional[ReprFileLocation] | ||||||
|  | @ -954,7 +953,7 @@ class ExceptionRepr(TerminalRepr): | ||||||
|             tw.line(content) |             tw.line(content) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ExceptionChainRepr(ExceptionRepr): | class ExceptionChainRepr(ExceptionRepr): | ||||||
|     chain = attr.ib( |     chain = attr.ib( | ||||||
|         type=Sequence[ |         type=Sequence[ | ||||||
|  | @ -978,7 +977,7 @@ class ExceptionChainRepr(ExceptionRepr): | ||||||
|         super().toterminal(tw) |         super().toterminal(tw) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ReprExceptionInfo(ExceptionRepr): | class ReprExceptionInfo(ExceptionRepr): | ||||||
|     reprtraceback = attr.ib(type="ReprTraceback") |     reprtraceback = attr.ib(type="ReprTraceback") | ||||||
|     reprcrash = attr.ib(type="ReprFileLocation") |     reprcrash = attr.ib(type="ReprFileLocation") | ||||||
|  | @ -988,7 +987,7 @@ class ReprExceptionInfo(ExceptionRepr): | ||||||
|         super().toterminal(tw) |         super().toterminal(tw) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ReprTraceback(TerminalRepr): | class ReprTraceback(TerminalRepr): | ||||||
|     reprentries = attr.ib(type=Sequence[Union["ReprEntry", "ReprEntryNative"]]) |     reprentries = attr.ib(type=Sequence[Union["ReprEntry", "ReprEntryNative"]]) | ||||||
|     extraline = attr.ib(type=Optional[str]) |     extraline = attr.ib(type=Optional[str]) | ||||||
|  | @ -1022,7 +1021,7 @@ class ReprTracebackNative(ReprTraceback): | ||||||
|         self.extraline = None |         self.extraline = None | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ReprEntryNative(TerminalRepr): | class ReprEntryNative(TerminalRepr): | ||||||
|     lines = attr.ib(type=Sequence[str]) |     lines = attr.ib(type=Sequence[str]) | ||||||
|     style = "native"  # type: _TracebackStyle |     style = "native"  # type: _TracebackStyle | ||||||
|  | @ -1031,7 +1030,7 @@ class ReprEntryNative(TerminalRepr): | ||||||
|         tw.write("".join(self.lines)) |         tw.write("".join(self.lines)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ReprEntry(TerminalRepr): | class ReprEntry(TerminalRepr): | ||||||
|     lines = attr.ib(type=Sequence[str]) |     lines = attr.ib(type=Sequence[str]) | ||||||
|     reprfuncargs = attr.ib(type=Optional["ReprFuncArgs"]) |     reprfuncargs = attr.ib(type=Optional["ReprFuncArgs"]) | ||||||
|  | @ -1111,7 +1110,7 @@ class ReprEntry(TerminalRepr): | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ReprFileLocation(TerminalRepr): | class ReprFileLocation(TerminalRepr): | ||||||
|     path = attr.ib(type=str, converter=str) |     path = attr.ib(type=str, converter=str) | ||||||
|     lineno = attr.ib(type=int) |     lineno = attr.ib(type=int) | ||||||
|  | @ -1128,7 +1127,7 @@ class ReprFileLocation(TerminalRepr): | ||||||
|         tw.line(":{}: {}".format(self.lineno, msg)) |         tw.line(":{}: {}".format(self.lineno, msg)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ReprLocals(TerminalRepr): | class ReprLocals(TerminalRepr): | ||||||
|     lines = attr.ib(type=Sequence[str]) |     lines = attr.ib(type=Sequence[str]) | ||||||
| 
 | 
 | ||||||
|  | @ -1137,7 +1136,7 @@ class ReprLocals(TerminalRepr): | ||||||
|             tw.line(indent + line) |             tw.line(indent + line) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @attr.s(**{ATTRS_EQ_FIELD: False})  # type: ignore | @attr.s(eq=False) | ||||||
| class ReprFuncArgs(TerminalRepr): | class ReprFuncArgs(TerminalRepr): | ||||||
|     args = attr.ib(type=Sequence[Tuple[str, object]]) |     args = attr.ib(type=Sequence[Tuple[str, object]]) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -16,7 +16,6 @@ from _pytest import outcomes | ||||||
| from _pytest._io.saferepr import _pformat_dispatch | from _pytest._io.saferepr import _pformat_dispatch | ||||||
| from _pytest._io.saferepr import safeformat | from _pytest._io.saferepr import safeformat | ||||||
| from _pytest._io.saferepr import saferepr | from _pytest._io.saferepr import saferepr | ||||||
| from _pytest.compat import ATTRS_EQ_FIELD |  | ||||||
| 
 | 
 | ||||||
| # The _reprcompare attribute on the util module is used by the new assertion | # The _reprcompare attribute on the util module is used by the new assertion | ||||||
| # interpretation code and assertion rewriter to detect this plugin was | # interpretation code and assertion rewriter to detect this plugin was | ||||||
|  | @ -420,9 +419,7 @@ def _compare_eq_cls( | ||||||
|         fields_to_check = [field for field, info in all_fields.items() if info.compare] |         fields_to_check = [field for field, info in all_fields.items() if info.compare] | ||||||
|     elif isattrs(left): |     elif isattrs(left): | ||||||
|         all_fields = left.__attrs_attrs__ |         all_fields = left.__attrs_attrs__ | ||||||
|         fields_to_check = [ |         fields_to_check = [field.name for field in all_fields if getattr(field, "eq")] | ||||||
|             field.name for field in all_fields if getattr(field, ATTRS_EQ_FIELD) |  | ||||||
|         ] |  | ||||||
| 
 | 
 | ||||||
|     indent = "  " |     indent = "  " | ||||||
|     same = [] |     same = [] | ||||||
|  |  | ||||||
|  | @ -371,12 +371,6 @@ else: | ||||||
|         return f |         return f | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| if getattr(attr, "__version_info__", ()) >= (19, 2): |  | ||||||
|     ATTRS_EQ_FIELD = "eq" |  | ||||||
| else: |  | ||||||
|     ATTRS_EQ_FIELD = "cmp" |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| if sys.version_info >= (3, 8): | if sys.version_info >= (3, 8): | ||||||
|     from functools import cached_property as cached_property |     from functools import cached_property as cached_property | ||||||
| else: | else: | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ import pytest | ||||||
| from _pytest import outcomes | from _pytest import outcomes | ||||||
| from _pytest.assertion import truncate | from _pytest.assertion import truncate | ||||||
| from _pytest.assertion import util | from _pytest.assertion import util | ||||||
| from _pytest.compat import ATTRS_EQ_FIELD |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def mock_config(verbose=0): | def mock_config(verbose=0): | ||||||
|  | @ -945,7 +944,7 @@ class TestAssert_reprcompare_attrsclass: | ||||||
|         @attr.s |         @attr.s | ||||||
|         class SimpleDataObject: |         class SimpleDataObject: | ||||||
|             field_a = attr.ib() |             field_a = attr.ib() | ||||||
|             field_b = attr.ib(**{ATTRS_EQ_FIELD: False})  # type: ignore |             field_b = attr.ib(eq=False) | ||||||
| 
 | 
 | ||||||
|         left = SimpleDataObject(1, "b") |         left = SimpleDataObject(1, "b") | ||||||
|         right = SimpleDataObject(1, "b") |         right = SimpleDataObject(1, "b") | ||||||
|  |  | ||||||
|  | @ -27,8 +27,6 @@ def test_no_warnings(module: str) -> None: | ||||||
|     subprocess.check_call(( |     subprocess.check_call(( | ||||||
|         sys.executable, |         sys.executable, | ||||||
|         "-W", "error", |         "-W", "error", | ||||||
|         # https://github.com/pytest-dev/pytest/issues/5901 |  | ||||||
|         "-W", "ignore:The usage of `cmp` is deprecated and will be removed on or after 2021-06-01.  Please use `eq` and `order` instead.:DeprecationWarning",  # noqa: E501 |  | ||||||
|         "-c", "__import__({!r})".format(module), |         "-c", "__import__({!r})".format(module), | ||||||
|     )) |     )) | ||||||
|     # fmt: on |     # fmt: on | ||||||
|  |  | ||||||
|  | @ -532,11 +532,7 @@ class TestTrialUnittest: | ||||||
|                 # will crash both at test time and at teardown |                 # will crash both at test time and at teardown | ||||||
|         """ |         """ | ||||||
|         ) |         ) | ||||||
|         # Ignore DeprecationWarning (for `cmp`) from attrs through twisted, |         result = testdir.runpytest("-vv", "-oconsole_output_style=classic") | ||||||
|         # for stable test results. |  | ||||||
|         result = testdir.runpytest( |  | ||||||
|             "-vv", "-oconsole_output_style=classic", "-W", "ignore::DeprecationWarning" |  | ||||||
|         ) |  | ||||||
|         result.stdout.fnmatch_lines( |         result.stdout.fnmatch_lines( | ||||||
|             [ |             [ | ||||||
|                 "test_trial_error.py::TC::test_four FAILED", |                 "test_trial_error.py::TC::test_four FAILED", | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								tox.ini
								
								
								
								
							
							
						
						
									
										2
									
								
								tox.ini
								
								
								
								
							|  | @ -45,8 +45,6 @@ setenv = | ||||||
| extras = testing | extras = testing | ||||||
| deps = | deps = | ||||||
|     doctesting: PyYAML |     doctesting: PyYAML | ||||||
|     oldattrs: attrs==17.4.0 |  | ||||||
|     oldattrs: hypothesis<=4.38.1 |  | ||||||
|     numpy: numpy |     numpy: numpy | ||||||
|     pexpect: pexpect |     pexpect: pexpect | ||||||
|     pluggymaster: git+https://github.com/pytest-dev/pluggy.git@master |     pluggymaster: git+https://github.com/pytest-dev/pluggy.git@master | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue