Merge branch 'pytest-dev:main' into patch-1
This commit is contained in:
commit
7df405747a
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.1.0
|
||||
rev: 22.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: [--safe, --quiet]
|
||||
|
@ -10,7 +10,7 @@ repos:
|
|||
- id: blacken-docs
|
||||
additional_dependencies: [black==20.8b1]
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.1.0
|
||||
rev: v4.2.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
|
@ -42,12 +42,12 @@ repos:
|
|||
- id: reorder-python-imports
|
||||
args: ['--application-directories=.:src', --py37-plus]
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.31.1
|
||||
rev: v2.32.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py37-plus]
|
||||
- repo: https://github.com/asottile/setup-cfg-fmt
|
||||
rev: v1.20.0
|
||||
rev: v1.20.1
|
||||
hooks:
|
||||
- id: setup-cfg-fmt
|
||||
args: [--max-py-version=3.10]
|
||||
|
@ -56,7 +56,7 @@ repos:
|
|||
hooks:
|
||||
- id: python-use-type-annotations
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.941
|
||||
rev: v0.942
|
||||
hooks:
|
||||
- id: mypy
|
||||
files: ^(src/|testing/)
|
||||
|
|
1
AUTHORS
1
AUTHORS
|
@ -256,6 +256,7 @@ Ondřej Súkup
|
|||
Oscar Benjamin
|
||||
Parth Patel
|
||||
Patrick Hayes
|
||||
Paul Müller
|
||||
Pauli Virtanen
|
||||
Pavel Karateev
|
||||
Paweł Adamczak
|
||||
|
|
|
@ -50,6 +50,8 @@ Fix bugs
|
|||
--------
|
||||
|
||||
Look through the `GitHub issues for bugs <https://github.com/pytest-dev/pytest/labels/type:%20bug>`_.
|
||||
See also the `"status: easy" issues <https://github.com/pytest-dev/pytest/labels/status%3A%20easy>`_
|
||||
that are friendly to new contributors.
|
||||
|
||||
:ref:`Talk <contact>` to developers to find out how you can fix specific bugs. To indicate that you are going
|
||||
to work on a particular issue, add a comment to that effect on the specific issue.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
On Python 3.11, use the standard library's :mod:`tomllib` to parse TOML.
|
||||
|
||||
:mod:`tomli`` is no longer a dependency on Python 3.11.
|
|
@ -0,0 +1 @@
|
|||
Fix comparison of ``dataclasses`` with ``InitVar``.
|
|
@ -0,0 +1,2 @@
|
|||
Increase ``stacklevel`` for the ``NODE_CTOR_FSPATH_ARG`` deprecation to point to the
|
||||
user's code, not pytest.
|
|
@ -0,0 +1,2 @@
|
|||
Fix a bizarre (and fortunately rare) bug where the `temp_path` fixture could raise
|
||||
an internal error while attempting to get the current user's username.
|
|
@ -196,7 +196,7 @@ want to distribute them along with your application:
|
|||
__init__.py
|
||||
app.py
|
||||
view.py
|
||||
test/
|
||||
tests/
|
||||
__init__.py
|
||||
test_app.py
|
||||
test_view.py
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,3 +5,6 @@ sphinx-removed-in>=0.2.0
|
|||
sphinx>=3.1,<4
|
||||
sphinxcontrib-trio
|
||||
sphinxcontrib-svg2pdfconverter
|
||||
|
||||
# XXX: sphinx<4 is broken with latest jinja2
|
||||
jinja2<3.1
|
||||
|
|
|
@ -46,10 +46,10 @@ install_requires =
|
|||
packaging
|
||||
pluggy>=0.12,<2.0
|
||||
py>=1.8.2
|
||||
tomli>=1.0.0
|
||||
atomicwrites>=1.0;sys_platform=="win32"
|
||||
colorama;sys_platform=="win32"
|
||||
importlib-metadata>=0.12;python_version<"3.8"
|
||||
tomli>=1.0.0;python_version<"3.11"
|
||||
python_requires = >=3.7
|
||||
package_dir =
|
||||
=src
|
||||
|
|
|
@ -437,8 +437,10 @@ def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]:
|
|||
if not has_default_eq(left):
|
||||
return []
|
||||
if isdatacls(left):
|
||||
all_fields = left.__dataclass_fields__
|
||||
fields_to_check = [field for field, info in all_fields.items() if info.compare]
|
||||
import dataclasses
|
||||
|
||||
all_fields = dataclasses.fields(left)
|
||||
fields_to_check = [info.name for info in all_fields if info.compare]
|
||||
elif isattrs(left):
|
||||
all_fields = left.__attrs_attrs__
|
||||
fields_to_check = [field.name for field in all_fields if getattr(field, "eq")]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
from typing import Iterable
|
||||
|
@ -64,12 +65,15 @@ def load_config_dict_from_file(
|
|||
|
||||
# '.toml' files are considered if they contain a [tool.pytest.ini_options] table.
|
||||
elif filepath.suffix == ".toml":
|
||||
import tomli
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib
|
||||
else:
|
||||
import tomli as tomllib
|
||||
|
||||
toml_text = filepath.read_text(encoding="utf-8")
|
||||
try:
|
||||
config = tomli.loads(toml_text)
|
||||
except tomli.TOMLDecodeError as exc:
|
||||
config = tomllib.loads(toml_text)
|
||||
except tomllib.TOMLDecodeError as exc:
|
||||
raise UsageError(f"{filepath}: {exc}") from exc
|
||||
|
||||
result = config.get("tool", {}).get("pytest", {}).get("ini_options", None)
|
||||
|
|
|
@ -111,7 +111,7 @@ def _imply_path(
|
|||
NODE_CTOR_FSPATH_ARG.format(
|
||||
node_type_name=node_type.__name__,
|
||||
),
|
||||
stacklevel=3,
|
||||
stacklevel=6,
|
||||
)
|
||||
if path is not None:
|
||||
if fspath is not None:
|
||||
|
|
|
@ -158,9 +158,10 @@ class TempPathFactory:
|
|||
def get_user() -> Optional[str]:
|
||||
"""Return the current user name, or None if getuser() does not work
|
||||
in the current environment (see #1010)."""
|
||||
import getpass
|
||||
|
||||
try:
|
||||
# In some exotic environments, getpass may not be importable.
|
||||
import getpass
|
||||
|
||||
return getpass.getuser()
|
||||
except (ImportError, KeyError):
|
||||
return None
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
from dataclasses import dataclass
|
||||
from dataclasses import InitVar
|
||||
|
||||
|
||||
@dataclass
|
||||
class Foo:
|
||||
init_only: InitVar[int]
|
||||
real_attr: int
|
||||
|
||||
|
||||
def test_demonstrate():
|
||||
assert Foo(1, 2) == Foo(1, 3)
|
|
@ -1,6 +1,6 @@
|
|||
anyio[curio,trio]==3.5.0
|
||||
django==4.0.3
|
||||
pytest-asyncio==0.18.2
|
||||
django==4.0.4
|
||||
pytest-asyncio==0.18.3
|
||||
pytest-bdd==5.0.0
|
||||
pytest-cov==3.0.0
|
||||
pytest-django==4.5.2
|
||||
|
@ -11,5 +11,5 @@ pytest-rerunfailures==10.2
|
|||
pytest-sugar==0.9.4
|
||||
pytest-trio==0.7.0
|
||||
pytest-twisted==1.13.4
|
||||
twisted==22.2.0
|
||||
twisted==22.4.0
|
||||
pytest-xvfb==2.0.0
|
||||
|
|
|
@ -882,6 +882,13 @@ class TestAssert_reprcompare_dataclass:
|
|||
result.assert_outcomes(failed=1, passed=0)
|
||||
result.stdout.no_re_match_line(".*Differing attributes.*")
|
||||
|
||||
def test_data_classes_with_initvar(self, pytester: Pytester) -> None:
|
||||
p = pytester.copy_example("dataclasses/test_compare_initvar.py")
|
||||
# issue 9820
|
||||
result = pytester.runpytest(p, "-vv")
|
||||
result.assert_outcomes(failed=1, passed=0)
|
||||
result.stdout.no_re_match_line(".*AttributeError.*")
|
||||
|
||||
|
||||
class TestAssert_reprcompare_attrsclass:
|
||||
def test_attrs(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue