Skip to content

Commit

Permalink
Merge pull request #3234 from Zac-HD/new-pytest-traceback-warning
Browse files Browse the repository at this point in the history
Avoid pytest warning from rich tracebacks
  • Loading branch information
Zac-HD committed Feb 21, 2022
2 parents cd46356 + ae5bf9e commit 67f07f2
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 25 deletions.
4 changes: 4 additions & 0 deletions hypothesis-python/RELEASE.rst
@@ -0,0 +1,4 @@
RELEASE_TYPE: patch

This patch fixes a warning under :pypi:`pytest` 7 relating to our
rich traceback display logic (:issue:`3223`).
8 changes: 6 additions & 2 deletions hypothesis-python/src/hypothesis/internal/escalation.py
Expand Up @@ -133,9 +133,13 @@ def get_interesting_origin(exception):

def _get_exceptioninfo():
# ExceptionInfo was moved to the top-level namespace in Pytest 7.0
for module in ["pytest", "_pytest._code"]:
if "pytest" in sys.modules:
with contextlib.suppress(Exception):
return sys.modules[module].ExceptionInfo
# From Pytest 7, __init__ warns on direct calls.
return sys.modules["pytest"].ExceptionInfo.from_exc_info
if "_pytest._code" in sys.modules: # pragma: no cover # old versions only
with contextlib.suppress(Exception):
return sys.modules["_pytest._code"].ExceptionInfo
return None # pragma: no cover # coverage tests always use pytest


Expand Down
@@ -1,4 +1,4 @@
# Version 2022021200, Last Updated Sat Feb 12 07:07:01 2022 UTC
# Version 2022021900, Last Updated Sat Feb 19 07:07:02 2022 UTC
AAA
AARP
ABARTH
Expand Down Expand Up @@ -176,7 +176,6 @@ BROTHER
BRUSSELS
BS
BT
BUDAPEST
BUGATTI
BUILD
BUILDERS
Expand Down
11 changes: 6 additions & 5 deletions requirements/coverage.txt
Expand Up @@ -12,7 +12,7 @@ backports-zoneinfo==0.2.1
# via -r requirements/coverage.in
black==22.1.0
# via -r requirements/coverage.in
click==8.0.3
click==8.0.4
# via
# -r requirements/coverage.in
# black
Expand All @@ -24,7 +24,7 @@ dpcontracts==0.6.0
# via -r requirements/coverage.in
execnet==1.9.0
# via pytest-xdist
fakeredis==1.7.0
fakeredis==1.7.1
# via -r requirements/coverage.in
iniconfig==1.1.1
# via pytest
Expand All @@ -44,13 +44,14 @@ packaging==21.3
# via
# fakeredis
# pytest
# redis
pandas==1.4.1
# via -r requirements/coverage.in
pathspec==0.9.0
# via black
pexpect==4.8.0
# via -r requirements/test.in
platformdirs==2.5.0
platformdirs==2.5.1
# via black
pluggy==1.0.0
# via pytest
Expand Down Expand Up @@ -81,7 +82,7 @@ pytz==2021.3
# pandas
pyyaml==6.0
# via libcst
redis==4.0.2
redis==4.1.4
# via fakeredis
six==1.16.0
# via
Expand All @@ -95,7 +96,7 @@ tomli==2.0.1
# via
# black
# pytest
typing-extensions==4.1.0
typing-extensions==4.1.1
# via
# -r requirements/coverage.in
# black
Expand Down
22 changes: 11 additions & 11 deletions requirements/tools.txt
Expand Up @@ -41,7 +41,7 @@ cffi==1.15.0
# via cryptography
charset-normalizer==2.0.12
# via requests
click==8.0.3
click==8.0.4
# via
# black
# pip-tools
Expand Down Expand Up @@ -71,7 +71,7 @@ dpcontracts==0.6.0
# via -r requirements/tools.in
executing==0.8.2
# via stack-data
filelock==3.4.2
filelock==3.6.0
# via
# tox
# virtualenv
Expand Down Expand Up @@ -110,7 +110,7 @@ flake8-noqa==1.2.1
# via -r requirements/tools.in
flake8-polyfill==1.0.2
# via flake8-bandit
flake8-simplify==0.16.0
flake8-simplify==0.17.1
# via -r requirements/tools.in
flake8-strftime==0.3.2
# via -r requirements/tools.in
Expand All @@ -122,7 +122,7 @@ idna==3.3
# via requests
imagesize==1.3.0
# via sphinx
importlib-metadata==4.11.0
importlib-metadata==4.11.1
# via
# keyring
# sphinx
Expand All @@ -149,7 +149,7 @@ libcst==0.4.1
# via
# -r requirements/tools.in
# shed
markupsafe==2.0.1
markupsafe==2.1.0
# via jinja2
matplotlib-inline==0.1.3
# via ipython
Expand Down Expand Up @@ -184,7 +184,7 @@ pip-tools==6.5.1
# via -r requirements/tools.in
pkginfo==1.8.2
# via twine
platformdirs==2.5.0
platformdirs==2.5.1
# via
# black
# virtualenv
Expand Down Expand Up @@ -249,7 +249,7 @@ rfc3986==2.0.0
# via twine
secretstorage==3.3.1
# via keyring
shed==0.9.0
shed==0.9.1
# via -r requirements/tools.in
six==1.16.0
# via
Expand Down Expand Up @@ -295,7 +295,7 @@ sphinxcontrib-serializinghtml==1.1.5
# via sphinx
sqlparse==0.4.2
# via django
stack-data==0.1.4
stack-data==0.2.0
# via ipython
stevedore==3.5.0
# via bandit
Expand Down Expand Up @@ -325,11 +325,11 @@ types-click==7.1.8
# via -r requirements/tools.in
types-pkg-resources==0.1.3
# via -r requirements/tools.in
types-pytz==2021.3.4
types-pytz==2021.3.5
# via -r requirements/tools.in
types-redis==4.1.15
types-redis==4.1.16
# via -r requirements/tools.in
typing-extensions==4.1.0
typing-extensions==4.1.1
# via
# black
# flake8-noqa
Expand Down
5 changes: 3 additions & 2 deletions tooling/src/hypothesistooling/__main__.py
Expand Up @@ -16,12 +16,13 @@
from glob import glob
from urllib.parse import urlparse

import requests
from coverage.config import CoverageConfig

import hypothesistooling as tools
import hypothesistooling.projects.conjecturerust as cr
import hypothesistooling.projects.hypothesispython as hp
import hypothesistooling.projects.hypothesisruby as hr
import requests
from coverage.config import CoverageConfig
from hypothesistooling import installers as install, releasemanagement as rm
from hypothesistooling.scripts import pip_tool

Expand Down
3 changes: 2 additions & 1 deletion tooling/src/hypothesistooling/projects/hypothesispython.py
Expand Up @@ -14,8 +14,9 @@
import subprocess
import sys

import hypothesistooling as tools
import requests

import hypothesistooling as tools
from hypothesistooling import releasemanagement as rm

PACKAGE_NAME = "hypothesis-python"
Expand Down
3 changes: 2 additions & 1 deletion whole-repo-tests/test_deploy.py
Expand Up @@ -10,8 +10,9 @@

import os

import hypothesistooling as tools
import pytest

import hypothesistooling as tools
from hypothesistooling import __main__ as main, releasemanagement as rm


Expand Down
3 changes: 2 additions & 1 deletion whole-repo-tests/test_release_files.py
Expand Up @@ -8,8 +8,9 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.

import hypothesistooling as tools
import pytest

import hypothesistooling as tools
from hypothesistooling import releasemanagement as rm


Expand Down
1 change: 1 addition & 0 deletions whole-repo-tests/test_release_management.py
Expand Up @@ -9,6 +9,7 @@
# obtain one at https://mozilla.org/MPL/2.0/.

import pytest

from hypothesistooling.releasemanagement import (
bump_version_info,
parse_release_file_contents,
Expand Down
1 change: 1 addition & 0 deletions whole-repo-tests/test_type_hints.py
Expand Up @@ -12,6 +12,7 @@
import subprocess

import pytest

from hypothesistooling.projects.hypothesispython import PYTHON_SRC
from hypothesistooling.scripts import pip_tool, tool_path

Expand Down

0 comments on commit 67f07f2

Please sign in to comment.