Compare commits
1 Commits
update-plu
...
update-plu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3902c79ec9 |
@@ -25,7 +25,6 @@ exclude_lines =
|
|||||||
^\s*raise NotImplementedError\b
|
^\s*raise NotImplementedError\b
|
||||||
^\s*return NotImplemented\b
|
^\s*return NotImplemented\b
|
||||||
^\s*assert False(,|$)
|
^\s*assert False(,|$)
|
||||||
^\s*assert_never\(
|
|
||||||
|
|
||||||
^\s*if TYPE_CHECKING:
|
^\s*if TYPE_CHECKING:
|
||||||
^\s*@overload( |$)
|
^\s*@overload( |$)
|
||||||
|
|||||||
6
.github/dependabot.yml
vendored
@@ -9,9 +9,3 @@ updates:
|
|||||||
allow:
|
allow:
|
||||||
- dependency-type: direct
|
- dependency-type: direct
|
||||||
- dependency-type: indirect
|
- dependency-type: indirect
|
||||||
- package-ecosystem: github-actions
|
|
||||||
directory: /
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
time: "03:00"
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
|
|||||||
51
.github/workflows/backport.yml
vendored
@@ -1,51 +0,0 @@
|
|||||||
name: backport
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Note that `pull_request_target` has security implications:
|
|
||||||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
|
||||||
# In particular:
|
|
||||||
# - Only allow triggers that can be used only be trusted users
|
|
||||||
# - Don't execute any code from the target branch
|
|
||||||
# - Don't use cache
|
|
||||||
pull_request_target:
|
|
||||||
types: [labeled]
|
|
||||||
|
|
||||||
# Set permissions at the job level.
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
backport:
|
|
||||||
if: startsWith(github.event.label.name, 'backport ') && github.event.pull_request.merged
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: true
|
|
||||||
|
|
||||||
- name: Create backport PR
|
|
||||||
run: |
|
|
||||||
set -eux
|
|
||||||
|
|
||||||
git config --global user.name "pytest bot"
|
|
||||||
git config --global user.email "pytestbot@gmail.com"
|
|
||||||
|
|
||||||
label='${{ github.event.label.name }}'
|
|
||||||
target_branch="${label#backport }"
|
|
||||||
backport_branch=backport-${{ github.event.number }}-to-"${target_branch}"
|
|
||||||
subject="[$target_branch] $(gh pr view --json title -q .title ${{ github.event.number }})"
|
|
||||||
|
|
||||||
git checkout origin/"${target_branch}" -b "${backport_branch}"
|
|
||||||
git cherry-pick -x --mainline 1 ${{ github.event.pull_request.merge_commit_sha }}
|
|
||||||
git commit --amend --message "$subject"
|
|
||||||
git push --set-upstream origin --force-with-lease "${backport_branch}"
|
|
||||||
gh pr create \
|
|
||||||
--base "${target_branch}" \
|
|
||||||
--title "${subject}" \
|
|
||||||
--body "Backport of PR #${{ github.event.number }} to $target_branch branch. PR created by backport workflow."
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
55
.github/workflows/deploy.yml
vendored
@@ -1,55 +0,0 @@
|
|||||||
name: deploy
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
# These tags are protected, see:
|
|
||||||
# https://github.com/pytest-dev/pytest/settings/tag_protection
|
|
||||||
- "[0-9]+.[0-9]+.[0-9]+"
|
|
||||||
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
|
|
||||||
|
|
||||||
|
|
||||||
# Set permissions at the job level.
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
if: github.repository == 'pytest-dev/pytest'
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 30
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: "3.7"
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install --upgrade build tox
|
|
||||||
|
|
||||||
- name: Build package
|
|
||||||
run: |
|
|
||||||
python -m build
|
|
||||||
|
|
||||||
- name: Publish package to PyPI
|
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
|
||||||
with:
|
|
||||||
password: ${{ secrets.pypi_token }}
|
|
||||||
|
|
||||||
- name: Publish GitHub release notes
|
|
||||||
env:
|
|
||||||
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
sudo apt-get install pandoc
|
|
||||||
tox -e publish-gh-release-notes
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
name: test
|
name: main
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- "[0-9]+.[0-9]+.x"
|
- "[0-9]+.[0-9]+.x"
|
||||||
- "test-me-*"
|
|
||||||
tags:
|
tags:
|
||||||
- "[0-9]+.[0-9]+.[0-9]+"
|
- "[0-9]+.[0-9]+.[0-9]+"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
|
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
|
||||||
@@ -24,7 +23,7 @@ permissions: {}
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
timeout-minutes: 45
|
timeout-minutes: 30
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -32,26 +31,24 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
name: [
|
name: [
|
||||||
|
"windows-py36",
|
||||||
"windows-py37",
|
"windows-py37",
|
||||||
"windows-py37-pluggy",
|
"windows-py37-pluggy",
|
||||||
"windows-py38",
|
"windows-py38",
|
||||||
"windows-py39",
|
"windows-py39",
|
||||||
"windows-py310",
|
"windows-py310",
|
||||||
"windows-py311",
|
|
||||||
|
|
||||||
|
"ubuntu-py36",
|
||||||
"ubuntu-py37",
|
"ubuntu-py37",
|
||||||
"ubuntu-py37-pluggy",
|
"ubuntu-py37-pluggy",
|
||||||
"ubuntu-py37-freeze",
|
"ubuntu-py37-freeze",
|
||||||
"ubuntu-py38",
|
"ubuntu-py38",
|
||||||
"ubuntu-py39",
|
"ubuntu-py39",
|
||||||
"ubuntu-py310",
|
"ubuntu-py310",
|
||||||
"ubuntu-py311",
|
|
||||||
"ubuntu-pypy3",
|
"ubuntu-pypy3",
|
||||||
|
|
||||||
"macos-py37",
|
"macos-py37",
|
||||||
"macos-py38",
|
"macos-py38",
|
||||||
"macos-py39",
|
|
||||||
"macos-py310",
|
|
||||||
|
|
||||||
"docs",
|
"docs",
|
||||||
"doctesting",
|
"doctesting",
|
||||||
@@ -59,6 +56,10 @@ jobs:
|
|||||||
]
|
]
|
||||||
|
|
||||||
include:
|
include:
|
||||||
|
- name: "windows-py36"
|
||||||
|
python: "3.6"
|
||||||
|
os: windows-latest
|
||||||
|
tox_env: "py36-xdist"
|
||||||
- name: "windows-py37"
|
- name: "windows-py37"
|
||||||
python: "3.7"
|
python: "3.7"
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
@@ -66,7 +67,7 @@ jobs:
|
|||||||
- name: "windows-py37-pluggy"
|
- name: "windows-py37-pluggy"
|
||||||
python: "3.7"
|
python: "3.7"
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
tox_env: "py37-pluggymain-pylib-xdist"
|
tox_env: "py37-pluggymain-xdist"
|
||||||
- name: "windows-py38"
|
- name: "windows-py38"
|
||||||
python: "3.8"
|
python: "3.8"
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
@@ -77,14 +78,14 @@ jobs:
|
|||||||
os: windows-latest
|
os: windows-latest
|
||||||
tox_env: "py39-xdist"
|
tox_env: "py39-xdist"
|
||||||
- name: "windows-py310"
|
- name: "windows-py310"
|
||||||
python: "3.10"
|
python: "3.10-dev"
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
tox_env: "py310-xdist"
|
tox_env: "py310-xdist"
|
||||||
- name: "windows-py311"
|
|
||||||
python: "3.11-dev"
|
|
||||||
os: windows-latest
|
|
||||||
tox_env: "py311"
|
|
||||||
|
|
||||||
|
- name: "ubuntu-py36"
|
||||||
|
python: "3.6"
|
||||||
|
os: ubuntu-latest
|
||||||
|
tox_env: "py36-xdist"
|
||||||
- name: "ubuntu-py37"
|
- name: "ubuntu-py37"
|
||||||
python: "3.7"
|
python: "3.7"
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
@@ -93,7 +94,7 @@ jobs:
|
|||||||
- name: "ubuntu-py37-pluggy"
|
- name: "ubuntu-py37-pluggy"
|
||||||
python: "3.7"
|
python: "3.7"
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
tox_env: "py37-pluggymain-pylib-xdist"
|
tox_env: "py37-pluggymain-xdist"
|
||||||
- name: "ubuntu-py37-freeze"
|
- name: "ubuntu-py37-freeze"
|
||||||
python: "3.7"
|
python: "3.7"
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
@@ -107,14 +108,9 @@ jobs:
|
|||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
tox_env: "py39-xdist"
|
tox_env: "py39-xdist"
|
||||||
- name: "ubuntu-py310"
|
- name: "ubuntu-py310"
|
||||||
python: "3.10"
|
python: "3.10-dev"
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
tox_env: "py310-xdist"
|
tox_env: "py310-xdist"
|
||||||
- name: "ubuntu-py311"
|
|
||||||
python: "3.11-dev"
|
|
||||||
os: ubuntu-latest
|
|
||||||
tox_env: "py311"
|
|
||||||
use_coverage: true
|
|
||||||
- name: "ubuntu-pypy3"
|
- name: "ubuntu-pypy3"
|
||||||
python: "pypy-3.7"
|
python: "pypy-3.7"
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
@@ -129,17 +125,9 @@ jobs:
|
|||||||
os: macos-latest
|
os: macos-latest
|
||||||
tox_env: "py38-xdist"
|
tox_env: "py38-xdist"
|
||||||
use_coverage: true
|
use_coverage: true
|
||||||
- name: "macos-py39"
|
|
||||||
python: "3.9"
|
|
||||||
os: macos-latest
|
|
||||||
tox_env: "py39-xdist"
|
|
||||||
- name: "macos-py310"
|
|
||||||
python: "3.10"
|
|
||||||
os: macos-latest
|
|
||||||
tox_env: "py310-xdist"
|
|
||||||
|
|
||||||
- name: "plugins"
|
- name: "plugins"
|
||||||
python: "3.9"
|
python: "3.7"
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
tox_env: "plugins"
|
tox_env: "plugins"
|
||||||
|
|
||||||
@@ -154,13 +142,13 @@ jobs:
|
|||||||
use_coverage: true
|
use_coverage: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python }}
|
- name: Set up Python ${{ matrix.python }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
|
|
||||||
@@ -177,15 +165,78 @@ jobs:
|
|||||||
if: "matrix.use_coverage"
|
if: "matrix.use_coverage"
|
||||||
run: "tox -e ${{ matrix.tox_env }}-coverage"
|
run: "tox -e ${{ matrix.tox_env }}-coverage"
|
||||||
|
|
||||||
- name: Generate coverage report
|
- name: Upload coverage
|
||||||
if: "matrix.use_coverage"
|
if: matrix.use_coverage && github.repository == 'pytest-dev/pytest'
|
||||||
run: python -m coverage xml
|
env:
|
||||||
|
CODECOV_NAME: ${{ matrix.name }}
|
||||||
|
run: bash scripts/upload-coverage.sh -F GHA,${{ runner.os }}
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
linting:
|
||||||
if: "matrix.use_coverage"
|
runs-on: ubuntu-latest
|
||||||
uses: codecov/codecov-action@v3
|
permissions:
|
||||||
continue-on-error: true
|
contents: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
persist-credentials: false
|
||||||
files: ./coverage.xml
|
|
||||||
verbose: true
|
- uses: actions/setup-python@v2
|
||||||
|
|
||||||
|
- name: set PY
|
||||||
|
run: echo "name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pre-commit
|
||||||
|
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install tox
|
||||||
|
|
||||||
|
- run: tox -e linting
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
needs: [build]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.7"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade wheel setuptools tox
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
run: |
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
|
- name: Publish package to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@master
|
||||||
|
with:
|
||||||
|
user: __token__
|
||||||
|
password: ${{ secrets.pypi_token }}
|
||||||
|
|
||||||
|
- name: Publish GitHub release notes
|
||||||
|
env:
|
||||||
|
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get install pandoc
|
||||||
|
tox -e publish-gh-release-notes
|
||||||
13
.github/workflows/prepare-release-pr.yml
vendored
@@ -11,10 +11,6 @@ on:
|
|||||||
description: 'Major release? (yes/no)'
|
description: 'Major release? (yes/no)'
|
||||||
required: true
|
required: true
|
||||||
default: 'no'
|
default: 'no'
|
||||||
prerelease:
|
|
||||||
description: 'Prerelease (ex: rc1). Leave empty if not a pre-release.'
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
|
|
||||||
# Set permissions at the job level.
|
# Set permissions at the job level.
|
||||||
permissions: {}
|
permissions: {}
|
||||||
@@ -27,12 +23,13 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: "3.8"
|
python-version: "3.8"
|
||||||
|
|
||||||
@@ -44,9 +41,9 @@ jobs:
|
|||||||
- name: Prepare release PR (minor/patch release)
|
- name: Prepare release PR (minor/patch release)
|
||||||
if: github.event.inputs.major == 'no'
|
if: github.event.inputs.major == 'no'
|
||||||
run: |
|
run: |
|
||||||
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --prerelease='${{ github.event.inputs.prerelease }}'
|
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }}
|
||||||
|
|
||||||
- name: Prepare release PR (major release)
|
- name: Prepare release PR (major release)
|
||||||
if: github.event.inputs.major == 'yes'
|
if: github.event.inputs.major == 'yes'
|
||||||
run: |
|
run: |
|
||||||
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major --prerelease='${{ github.event.inputs.prerelease }}'
|
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major
|
||||||
|
|||||||
40
.github/workflows/release-on-comment.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# part of our release process, see `release-on-comment.py`
|
||||||
|
name: release on comment
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened, edited]
|
||||||
|
issue_comment:
|
||||||
|
types: [created, edited]
|
||||||
|
|
||||||
|
# Set permissions at the job level.
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
if: (github.event.comment && startsWith(github.event.comment.body, '@pytestbot please')) || (github.event.issue && !github.event.comment && startsWith(github.event.issue.body, '@pytestbot please'))
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.8"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade setuptools tox
|
||||||
|
|
||||||
|
- name: Prepare release
|
||||||
|
run: |
|
||||||
|
tox -e release-on-comment -- $GITHUB_EVENT_PATH ${{ github.token }}
|
||||||
11
.github/workflows/update-plugin-list.yml
vendored
@@ -11,8 +11,7 @@ on:
|
|||||||
permissions: {}
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-plugin-list:
|
createPullRequest:
|
||||||
if: github.repository_owner == 'pytest-dev'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -20,25 +19,25 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install packaging requests tabulate[widechars] tqdm
|
pip install packaging requests tabulate[widechars]
|
||||||
|
|
||||||
- name: Update Plugin List
|
- name: Update Plugin List
|
||||||
run: python scripts/update-plugin-list.py
|
run: python scripts/update-plugin-list.py
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04
|
uses: peter-evans/create-pull-request@2455e1596942c2902952003bbb574afbbe2ab2e6
|
||||||
with:
|
with:
|
||||||
commit-message: '[automated] Update plugin list'
|
commit-message: '[automated] Update plugin list'
|
||||||
author: 'pytest bot <pytestbot@users.noreply.github.com>'
|
author: 'pytest bot <pytestbot@users.noreply.github.com>'
|
||||||
|
|||||||
4
.gitignore
vendored
@@ -50,10 +50,6 @@ coverage.xml
|
|||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.vscode
|
.vscode
|
||||||
__pycache__/
|
|
||||||
|
|
||||||
# generated by pip
|
# generated by pip
|
||||||
pip-wheel-metadata/
|
pip-wheel-metadata/
|
||||||
|
|
||||||
# pytest debug logs generated via --debug
|
|
||||||
pytestdebug.log
|
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
default_language_version:
|
|
||||||
python: "3.10"
|
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.12.0
|
rev: 21.5b2
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args: [--safe, --quiet]
|
args: [--safe, --quiet]
|
||||||
- repo: https://github.com/asottile/blacken-docs
|
- repo: https://github.com/asottile/blacken-docs
|
||||||
rev: v1.12.1
|
rev: v1.10.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: blacken-docs
|
- id: blacken-docs
|
||||||
additional_dependencies: [black==20.8b1]
|
additional_dependencies: [black==20.8b1]
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.0.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
@@ -22,56 +20,44 @@ repos:
|
|||||||
- id: debug-statements
|
- id: debug-statements
|
||||||
exclude: _pytest/(debugging|hookspec).py
|
exclude: _pytest/(debugging|hookspec).py
|
||||||
language_version: python3
|
language_version: python3
|
||||||
- repo: https://github.com/PyCQA/autoflake
|
|
||||||
rev: v2.0.0
|
|
||||||
hooks:
|
|
||||||
- id: autoflake
|
|
||||||
name: autoflake
|
|
||||||
args: ["--in-place", "--remove-unused-variables", "--remove-all-unused-imports"]
|
|
||||||
language: python
|
|
||||||
files: \.py$
|
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- repo: https://github.com/PyCQA/flake8
|
||||||
rev: 6.0.0
|
rev: 3.9.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
language_version: python3
|
language_version: python3
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
- flake8-typing-imports==1.12.0
|
- flake8-typing-imports==1.9.0
|
||||||
- flake8-docstrings==1.5.0
|
- flake8-docstrings==1.5.0
|
||||||
- repo: https://github.com/asottile/reorder_python_imports
|
- repo: https://github.com/asottile/reorder_python_imports
|
||||||
rev: v3.9.0
|
rev: v2.5.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: reorder-python-imports
|
- id: reorder-python-imports
|
||||||
args: ['--application-directories=.:src', --py37-plus]
|
args: ['--application-directories=.:src', --py36-plus]
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.3.1
|
rev: v2.19.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py37-plus]
|
args: [--py36-plus]
|
||||||
- repo: https://github.com/asottile/setup-cfg-fmt
|
- repo: https://github.com/asottile/setup-cfg-fmt
|
||||||
rev: v2.2.0
|
rev: v1.17.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: setup-cfg-fmt
|
- id: setup-cfg-fmt
|
||||||
args: ["--max-py-version=3.11", "--include-version-classifiers"]
|
args: [--max-py-version=3.10]
|
||||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||||
rev: v1.9.0
|
rev: v1.8.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: python-use-type-annotations
|
- id: python-use-type-annotations
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v0.991
|
rev: v0.812
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
files: ^(src/|testing/)
|
files: ^(src/|testing/)
|
||||||
args: []
|
args: []
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
- iniconfig>=1.1.0
|
- iniconfig>=1.1.0
|
||||||
|
- py>=1.8.2
|
||||||
- attrs>=19.2.0
|
- attrs>=19.2.0
|
||||||
- packaging
|
- packaging
|
||||||
- tomli
|
|
||||||
- types-pkg_resources
|
|
||||||
# for mypy running on python>=3.11 since exceptiongroup is only a dependency
|
|
||||||
# on <3.11
|
|
||||||
- exceptiongroup>=1.0.0rc8
|
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: rst
|
- id: rst
|
||||||
@@ -104,7 +90,7 @@ repos:
|
|||||||
types: [python]
|
types: [python]
|
||||||
- id: py-path-deprecated
|
- id: py-path-deprecated
|
||||||
name: py.path usage is deprecated
|
name: py.path usage is deprecated
|
||||||
exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py|src/_pytest/legacypath.py
|
exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py
|
||||||
language: pygrep
|
language: pygrep
|
||||||
entry: \bpy\.path\.local
|
entry: \bpy\.path\.local
|
||||||
types: [python]
|
types: [python]
|
||||||
|
|||||||
@@ -1,22 +1,12 @@
|
|||||||
version: 2
|
version: 2
|
||||||
|
|
||||||
python:
|
python:
|
||||||
|
version: 3.7
|
||||||
install:
|
install:
|
||||||
# Install pytest first, then doc/en/requirements.txt.
|
- requirements: doc/en/requirements.txt
|
||||||
# This order is important to honor any pins in doc/en/requirements.txt
|
- method: pip
|
||||||
# when the pinned library is also a dependency of pytest.
|
path: .
|
||||||
- method: pip
|
|
||||||
path: .
|
|
||||||
- requirements: doc/en/requirements.txt
|
|
||||||
|
|
||||||
build:
|
|
||||||
os: ubuntu-20.04
|
|
||||||
tools:
|
|
||||||
python: "3.9"
|
|
||||||
apt_packages:
|
|
||||||
- inkscape
|
|
||||||
|
|
||||||
formats:
|
formats:
|
||||||
- epub
|
- epub
|
||||||
- pdf
|
- pdf
|
||||||
- htmlzip
|
|
||||||
|
|||||||
54
AUTHORS
@@ -13,9 +13,7 @@ Ahn Ki-Wook
|
|||||||
Akiomi Kamakura
|
Akiomi Kamakura
|
||||||
Alan Velasco
|
Alan Velasco
|
||||||
Alexander Johnson
|
Alexander Johnson
|
||||||
Alexander King
|
|
||||||
Alexei Kozlenok
|
Alexei Kozlenok
|
||||||
Alice Purcell
|
|
||||||
Allan Feldman
|
Allan Feldman
|
||||||
Aly Sivji
|
Aly Sivji
|
||||||
Amir Elkess
|
Amir Elkess
|
||||||
@@ -38,15 +36,12 @@ Anton Grinevich
|
|||||||
Anton Lodder
|
Anton Lodder
|
||||||
Antony Lee
|
Antony Lee
|
||||||
Arel Cordero
|
Arel Cordero
|
||||||
Arias Emmanuel
|
|
||||||
Ariel Pillemer
|
Ariel Pillemer
|
||||||
Armin Rigo
|
Armin Rigo
|
||||||
Aron Coyle
|
Aron Coyle
|
||||||
Aron Curzon
|
Aron Curzon
|
||||||
Ashish Kurmi
|
|
||||||
Aviral Verma
|
Aviral Verma
|
||||||
Aviv Palivoda
|
Aviv Palivoda
|
||||||
Babak Keyvani
|
|
||||||
Barney Gale
|
Barney Gale
|
||||||
Ben Gartner
|
Ben Gartner
|
||||||
Ben Webb
|
Ben Webb
|
||||||
@@ -58,7 +53,6 @@ Brian Maissy
|
|||||||
Brian Okken
|
Brian Okken
|
||||||
Brianna Laugher
|
Brianna Laugher
|
||||||
Bruno Oliveira
|
Bruno Oliveira
|
||||||
Cal Jacobson
|
|
||||||
Cal Leeming
|
Cal Leeming
|
||||||
Carl Friedrich Bolz
|
Carl Friedrich Bolz
|
||||||
Carlos Jenkins
|
Carlos Jenkins
|
||||||
@@ -66,11 +60,9 @@ Ceridwen
|
|||||||
Charles Cloud
|
Charles Cloud
|
||||||
Charles Machalow
|
Charles Machalow
|
||||||
Charnjit SiNGH (CCSJ)
|
Charnjit SiNGH (CCSJ)
|
||||||
Cheuk Ting Ho
|
|
||||||
Chris Lamb
|
Chris Lamb
|
||||||
Chris NeJame
|
Chris NeJame
|
||||||
Chris Rose
|
Chris Rose
|
||||||
Chris Wheeler
|
|
||||||
Christian Boelsen
|
Christian Boelsen
|
||||||
Christian Fetzer
|
Christian Fetzer
|
||||||
Christian Neumüller
|
Christian Neumüller
|
||||||
@@ -83,14 +75,11 @@ Christopher Gilling
|
|||||||
Claire Cecil
|
Claire Cecil
|
||||||
Claudio Madotto
|
Claudio Madotto
|
||||||
CrazyMerlyn
|
CrazyMerlyn
|
||||||
Cristian Vera
|
|
||||||
Cyrus Maden
|
Cyrus Maden
|
||||||
Damian Skrzypczak
|
Damian Skrzypczak
|
||||||
Daniel Grana
|
Daniel Grana
|
||||||
Daniel Hahler
|
Daniel Hahler
|
||||||
Daniel Nuri
|
Daniel Nuri
|
||||||
Daniel Sánchez Castelló
|
|
||||||
Daniel Valenzuela Zenteno
|
|
||||||
Daniel Wandschneider
|
Daniel Wandschneider
|
||||||
Daniele Procida
|
Daniele Procida
|
||||||
Danielle Jenkins
|
Danielle Jenkins
|
||||||
@@ -104,7 +93,6 @@ David Vierra
|
|||||||
Daw-Ran Liou
|
Daw-Ran Liou
|
||||||
Debi Mishra
|
Debi Mishra
|
||||||
Denis Kirisov
|
Denis Kirisov
|
||||||
Denivy Braiam Rück
|
|
||||||
Dhiren Serai
|
Dhiren Serai
|
||||||
Diego Russo
|
Diego Russo
|
||||||
Dmitry Dygalo
|
Dmitry Dygalo
|
||||||
@@ -117,10 +105,8 @@ Edson Tadeu M. Manoel
|
|||||||
Eduardo Schettino
|
Eduardo Schettino
|
||||||
Eli Boyarski
|
Eli Boyarski
|
||||||
Elizaveta Shashkova
|
Elizaveta Shashkova
|
||||||
Éloi Rivard
|
|
||||||
Endre Galaczi
|
Endre Galaczi
|
||||||
Eric Hunsberger
|
Eric Hunsberger
|
||||||
Eric Liu
|
|
||||||
Eric Siegerman
|
Eric Siegerman
|
||||||
Erik Aronesty
|
Erik Aronesty
|
||||||
Erik M. Bray
|
Erik M. Bray
|
||||||
@@ -132,15 +118,12 @@ Feng Ma
|
|||||||
Florian Bruhin
|
Florian Bruhin
|
||||||
Florian Dahlitz
|
Florian Dahlitz
|
||||||
Floris Bruynooghe
|
Floris Bruynooghe
|
||||||
Gabriel Landau
|
|
||||||
Gabriel Reis
|
Gabriel Reis
|
||||||
Garvit Shubham
|
Garvit Shubham
|
||||||
Gene Wood
|
Gene Wood
|
||||||
George Kussumoto
|
George Kussumoto
|
||||||
Georgy Dyuldin
|
Georgy Dyuldin
|
||||||
Gergely Kalmár
|
|
||||||
Gleb Nikonorov
|
Gleb Nikonorov
|
||||||
Graeme Smecher
|
|
||||||
Graham Horler
|
Graham Horler
|
||||||
Greg Price
|
Greg Price
|
||||||
Gregory Lee
|
Gregory Lee
|
||||||
@@ -149,7 +132,6 @@ Grigorii Eremeev (budulianin)
|
|||||||
Guido Wesdorp
|
Guido Wesdorp
|
||||||
Guoqiang Zhang
|
Guoqiang Zhang
|
||||||
Harald Armin Massa
|
Harald Armin Massa
|
||||||
Harshna
|
|
||||||
Henk-Jaap Wagenaar
|
Henk-Jaap Wagenaar
|
||||||
Holger Kohr
|
Holger Kohr
|
||||||
Hugo van Kemenade
|
Hugo van Kemenade
|
||||||
@@ -158,12 +140,10 @@ Ian Bicking
|
|||||||
Ian Lesperance
|
Ian Lesperance
|
||||||
Ilya Konstantinov
|
Ilya Konstantinov
|
||||||
Ionuț Turturică
|
Ionuț Turturică
|
||||||
Itxaso Aizpurua
|
|
||||||
Iwan Briquemont
|
Iwan Briquemont
|
||||||
Jaap Broekhuizen
|
Jaap Broekhuizen
|
||||||
Jakob van Santen
|
Jakob van Santen
|
||||||
Jakub Mitoraj
|
Jakub Mitoraj
|
||||||
James Bourbeau
|
|
||||||
Jan Balster
|
Jan Balster
|
||||||
Janne Vanhala
|
Janne Vanhala
|
||||||
Jason R. Coombs
|
Jason R. Coombs
|
||||||
@@ -173,9 +153,7 @@ Jeff Rackauckas
|
|||||||
Jeff Widman
|
Jeff Widman
|
||||||
Jenni Rinker
|
Jenni Rinker
|
||||||
John Eddie Ayson
|
John Eddie Ayson
|
||||||
John Litborn
|
|
||||||
John Towler
|
John Towler
|
||||||
Jon Parise
|
|
||||||
Jon Sonesen
|
Jon Sonesen
|
||||||
Jonas Obrist
|
Jonas Obrist
|
||||||
Jordan Guymon
|
Jordan Guymon
|
||||||
@@ -185,8 +163,8 @@ Joseph Hunkeler
|
|||||||
Josh Karpel
|
Josh Karpel
|
||||||
Joshua Bronson
|
Joshua Bronson
|
||||||
Jurko Gospodnetić
|
Jurko Gospodnetić
|
||||||
Justice Ndou
|
|
||||||
Justyna Janczyszyn
|
Justyna Janczyszyn
|
||||||
|
Justice Ndou
|
||||||
Kale Kundert
|
Kale Kundert
|
||||||
Kamran Ahmad
|
Kamran Ahmad
|
||||||
Karl O. Pinc
|
Karl O. Pinc
|
||||||
@@ -195,14 +173,9 @@ Katarzyna Jachim
|
|||||||
Katarzyna Król
|
Katarzyna Król
|
||||||
Katerina Koukiou
|
Katerina Koukiou
|
||||||
Keri Volans
|
Keri Volans
|
||||||
Kevin C
|
|
||||||
Kevin Cox
|
Kevin Cox
|
||||||
Kevin Hierro Carrasco
|
|
||||||
Kevin J. Foley
|
Kevin J. Foley
|
||||||
Kian Eliasi
|
|
||||||
Kian-Meng Ang
|
|
||||||
Kodi B. Arfer
|
Kodi B. Arfer
|
||||||
Kojo Idrissa
|
|
||||||
Kostis Anagnostopoulos
|
Kostis Anagnostopoulos
|
||||||
Kristoffer Nordström
|
Kristoffer Nordström
|
||||||
Kyle Altendorf
|
Kyle Altendorf
|
||||||
@@ -225,7 +198,6 @@ Marcin Bachry
|
|||||||
Marco Gorelli
|
Marco Gorelli
|
||||||
Mark Abramowitz
|
Mark Abramowitz
|
||||||
Mark Dickinson
|
Mark Dickinson
|
||||||
Marko Pacak
|
|
||||||
Markus Unterwaditzer
|
Markus Unterwaditzer
|
||||||
Martijn Faassen
|
Martijn Faassen
|
||||||
Martin Altmayer
|
Martin Altmayer
|
||||||
@@ -239,6 +211,7 @@ Matthias Hafner
|
|||||||
Maxim Filipenko
|
Maxim Filipenko
|
||||||
Maximilian Cosmo Sitter
|
Maximilian Cosmo Sitter
|
||||||
mbyt
|
mbyt
|
||||||
|
Mickey Pashov
|
||||||
Michael Aquilina
|
Michael Aquilina
|
||||||
Michael Birtwell
|
Michael Birtwell
|
||||||
Michael Droettboom
|
Michael Droettboom
|
||||||
@@ -246,8 +219,6 @@ Michael Goerz
|
|||||||
Michael Krebs
|
Michael Krebs
|
||||||
Michael Seifert
|
Michael Seifert
|
||||||
Michal Wajszczuk
|
Michal Wajszczuk
|
||||||
Michał Zięba
|
|
||||||
Mickey Pashov
|
|
||||||
Mihai Capotă
|
Mihai Capotă
|
||||||
Mike Hoyle (hoylemd)
|
Mike Hoyle (hoylemd)
|
||||||
Mike Lundy
|
Mike Lundy
|
||||||
@@ -261,10 +232,9 @@ Nicholas Murphy
|
|||||||
Niclas Olofsson
|
Niclas Olofsson
|
||||||
Nicolas Delaby
|
Nicolas Delaby
|
||||||
Nikolay Kondratyev
|
Nikolay Kondratyev
|
||||||
Nipunn Koorapati
|
Olga Matoula
|
||||||
Oleg Pidsadnyi
|
Oleg Pidsadnyi
|
||||||
Oleg Sushchenko
|
Oleg Sushchenko
|
||||||
Olga Matoula
|
|
||||||
Oliver Bestwalter
|
Oliver Bestwalter
|
||||||
Omar Kohl
|
Omar Kohl
|
||||||
Omer Hadari
|
Omer Hadari
|
||||||
@@ -272,15 +242,12 @@ Ondřej Súkup
|
|||||||
Oscar Benjamin
|
Oscar Benjamin
|
||||||
Parth Patel
|
Parth Patel
|
||||||
Patrick Hayes
|
Patrick Hayes
|
||||||
Paul Müller
|
|
||||||
Paul Reece
|
|
||||||
Pauli Virtanen
|
Pauli Virtanen
|
||||||
Pavel Karateev
|
Pavel Karateev
|
||||||
Paweł Adamczak
|
Paweł Adamczak
|
||||||
Pedro Algarvio
|
Pedro Algarvio
|
||||||
Petter Strandmark
|
Petter Strandmark
|
||||||
Philipp Loose
|
Philipp Loose
|
||||||
Pierre Sassoulas
|
|
||||||
Pieter Mulder
|
Pieter Mulder
|
||||||
Piotr Banaszkiewicz
|
Piotr Banaszkiewicz
|
||||||
Piotr Helm
|
Piotr Helm
|
||||||
@@ -291,8 +258,8 @@ Pulkit Goyal
|
|||||||
Punyashloka Biswal
|
Punyashloka Biswal
|
||||||
Quentin Pradet
|
Quentin Pradet
|
||||||
Ralf Schmitt
|
Ralf Schmitt
|
||||||
Ralph Giles
|
|
||||||
Ram Rachum
|
Ram Rachum
|
||||||
|
Ralph Giles
|
||||||
Ran Benita
|
Ran Benita
|
||||||
Raphael Castaneda
|
Raphael Castaneda
|
||||||
Raphael Pierzina
|
Raphael Pierzina
|
||||||
@@ -309,7 +276,6 @@ Ruaridh Williamson
|
|||||||
Russel Winder
|
Russel Winder
|
||||||
Ryan Wooden
|
Ryan Wooden
|
||||||
Saiprasad Kale
|
Saiprasad Kale
|
||||||
Samuel Colvin
|
|
||||||
Samuel Dion-Girardeau
|
Samuel Dion-Girardeau
|
||||||
Samuel Searles-Bryant
|
Samuel Searles-Bryant
|
||||||
Samuele Pedroni
|
Samuele Pedroni
|
||||||
@@ -321,7 +287,6 @@ Seth Junot
|
|||||||
Shantanu Jain
|
Shantanu Jain
|
||||||
Shubham Adep
|
Shubham Adep
|
||||||
Simon Gomizelj
|
Simon Gomizelj
|
||||||
Simon Holesch
|
|
||||||
Simon Kerr
|
Simon Kerr
|
||||||
Skylar Downes
|
Skylar Downes
|
||||||
Srinivas Reddy Thatiparthy
|
Srinivas Reddy Thatiparthy
|
||||||
@@ -335,35 +300,28 @@ Sven-Hendrik Haase
|
|||||||
Sylvain Marié
|
Sylvain Marié
|
||||||
Tadek Teleżyński
|
Tadek Teleżyński
|
||||||
Takafumi Arakaki
|
Takafumi Arakaki
|
||||||
Taneli Hukkinen
|
|
||||||
Tanvi Mehta
|
Tanvi Mehta
|
||||||
Tarcisio Fischer
|
Tarcisio Fischer
|
||||||
Tareq Alayan
|
Tareq Alayan
|
||||||
Tatiana Ovary
|
|
||||||
Ted Xiao
|
Ted Xiao
|
||||||
Terje Runde
|
|
||||||
Thomas Grainger
|
Thomas Grainger
|
||||||
Thomas Hisch
|
Thomas Hisch
|
||||||
Tim Hoffmann
|
Tim Hoffmann
|
||||||
Tim Strazny
|
Tim Strazny
|
||||||
Tobias Diez
|
|
||||||
Tom Dalton
|
Tom Dalton
|
||||||
Tom Viner
|
Tom Viner
|
||||||
Tomáš Gavenčiak
|
Tomáš Gavenčiak
|
||||||
Tomer Keren
|
Tomer Keren
|
||||||
Tony Narlock
|
|
||||||
Tor Colvin
|
Tor Colvin
|
||||||
Trevor Bekolay
|
Trevor Bekolay
|
||||||
Tyler Goodlet
|
Tyler Goodlet
|
||||||
Tzu-ping Chung
|
Tzu-ping Chung
|
||||||
Vasily Kuznetsov
|
Vasily Kuznetsov
|
||||||
Victor Maryama
|
Victor Maryama
|
||||||
Victor Rodriguez
|
|
||||||
Victor Uriarte
|
Victor Uriarte
|
||||||
Vidar T. Fauske
|
Vidar T. Fauske
|
||||||
Virgil Dupras
|
Virgil Dupras
|
||||||
Vitaly Lashmanov
|
Vitaly Lashmanov
|
||||||
Vivaan Verma
|
|
||||||
Vlad Dragos
|
Vlad Dragos
|
||||||
Vlad Radziuk
|
Vlad Radziuk
|
||||||
Vladyslav Rachek
|
Vladyslav Rachek
|
||||||
@@ -377,11 +335,7 @@ Xixi Zhao
|
|||||||
Xuan Luong
|
Xuan Luong
|
||||||
Xuecong Liao
|
Xuecong Liao
|
||||||
Yoav Caspi
|
Yoav Caspi
|
||||||
Yusuke Kadowaki
|
|
||||||
Yuval Shimon
|
|
||||||
Zac Hatfield-Dodds
|
Zac Hatfield-Dodds
|
||||||
Zachary Kneupper
|
Zachary Kneupper
|
||||||
Zachary OBrien
|
|
||||||
Zhouxin Qiu
|
|
||||||
Zoltán Máté
|
Zoltán Máté
|
||||||
Zsolt Cserna
|
Zsolt Cserna
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ Fix bugs
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
Look through the `GitHub issues for bugs <https://github.com/pytest-dev/pytest/labels/type:%20bug>`_.
|
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
|
: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.
|
to work on a particular issue, add a comment to that effect on the specific issue.
|
||||||
@@ -223,7 +221,7 @@ changes you want to review and merge. Pull requests are stored on
|
|||||||
Once you send a pull request, we can discuss its potential modifications and
|
Once you send a pull request, we can discuss its potential modifications and
|
||||||
even add more commits to it later on. There's an excellent tutorial on how Pull
|
even add more commits to it later on. There's an excellent tutorial on how Pull
|
||||||
Requests work in the
|
Requests work in the
|
||||||
`GitHub Help Center <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests>`_.
|
`GitHub Help Center <https://help.github.com/articles/using-pull-requests/>`_.
|
||||||
|
|
||||||
Here is a simple overview, with pytest-specific bits:
|
Here is a simple overview, with pytest-specific bits:
|
||||||
|
|
||||||
@@ -244,11 +242,6 @@ Here is a simple overview, with pytest-specific bits:
|
|||||||
be released in micro releases whereas features will be released in
|
be released in micro releases whereas features will be released in
|
||||||
minor releases and incompatible changes in major releases.
|
minor releases and incompatible changes in major releases.
|
||||||
|
|
||||||
You will need the tags to test locally, so be sure you have the tags from the main repository. If you suspect you don't, set the main repository as upstream and fetch the tags::
|
|
||||||
|
|
||||||
$ git remote add upstream https://github.com/pytest-dev/pytest
|
|
||||||
$ git fetch upstream --tags
|
|
||||||
|
|
||||||
If you need some help with Git, follow this quick start
|
If you need some help with Git, follow this quick start
|
||||||
guide: https://git.wiki.kernel.org/index.php/QuickStart
|
guide: https://git.wiki.kernel.org/index.php/QuickStart
|
||||||
|
|
||||||
@@ -331,7 +324,7 @@ Here is a simple overview, with pytest-specific bits:
|
|||||||
Writing Tests
|
Writing Tests
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
Writing tests for plugins or for pytest itself is often done using the `pytester fixture <https://docs.pytest.org/en/stable/reference/reference.html#pytester>`_, as a "black-box" test.
|
Writing tests for plugins or for pytest itself is often done using the `pytester fixture <https://docs.pytest.org/en/stable/reference.html#pytester>`_, as a "black-box" test.
|
||||||
|
|
||||||
For example, to ensure a simple test passes you can write:
|
For example, to ensure a simple test passes you can write:
|
||||||
|
|
||||||
@@ -385,7 +378,7 @@ them.
|
|||||||
Backporting bug fixes for the next patch release
|
Backporting bug fixes for the next patch release
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
Pytest makes a feature release every few weeks or months. In between, patch releases
|
Pytest makes feature release every few weeks or months. In between, patch releases
|
||||||
are made to the previous feature release, containing bug fixes only. The bug fixes
|
are made to the previous feature release, containing bug fixes only. The bug fixes
|
||||||
usually fix regressions, but may be any change that should reach users before the
|
usually fix regressions, but may be any change that should reach users before the
|
||||||
next feature release.
|
next feature release.
|
||||||
@@ -394,17 +387,10 @@ Suppose for example that the latest release was 1.2.3, and you want to include
|
|||||||
a bug fix in 1.2.4 (check https://github.com/pytest-dev/pytest/releases for the
|
a bug fix in 1.2.4 (check https://github.com/pytest-dev/pytest/releases for the
|
||||||
actual latest release). The procedure for this is:
|
actual latest release). The procedure for this is:
|
||||||
|
|
||||||
#. First, make sure the bug is fixed in the ``main`` branch, with a regular pull
|
#. First, make sure the bug is fixed the ``main`` branch, with a regular pull
|
||||||
request, as described above. An exception to this is if the bug fix is not
|
request, as described above. An exception to this is if the bug fix is not
|
||||||
applicable to ``main`` anymore.
|
applicable to ``main`` anymore.
|
||||||
|
|
||||||
Automatic method:
|
|
||||||
|
|
||||||
Add a ``backport 1.2.x`` label to the PR you want to backport. This will create
|
|
||||||
a backport PR against the ``1.2.x`` branch.
|
|
||||||
|
|
||||||
Manual method:
|
|
||||||
|
|
||||||
#. ``git checkout origin/1.2.x -b backport-XXXX`` # use the main PR number here
|
#. ``git checkout origin/1.2.x -b backport-XXXX`` # use the main PR number here
|
||||||
|
|
||||||
#. Locate the merge commit on the PR, in the *merged* message, for example:
|
#. Locate the merge commit on the PR, in the *merged* message, for example:
|
||||||
|
|||||||
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2004 Holger Krekel and others
|
Copyright (c) 2004-2021 Holger Krekel and others
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|||||||
27
README.rst
@@ -20,8 +20,8 @@
|
|||||||
:target: https://codecov.io/gh/pytest-dev/pytest
|
:target: https://codecov.io/gh/pytest-dev/pytest
|
||||||
:alt: Code coverage Status
|
:alt: Code coverage Status
|
||||||
|
|
||||||
.. image:: https://github.com/pytest-dev/pytest/workflows/test/badge.svg
|
.. image:: https://github.com/pytest-dev/pytest/workflows/main/badge.svg
|
||||||
:target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Atest
|
:target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Amain
|
||||||
|
|
||||||
.. image:: https://results.pre-commit.ci/badge/github/pytest-dev/pytest/main.svg
|
.. image:: https://results.pre-commit.ci/badge/github/pytest-dev/pytest/main.svg
|
||||||
:target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest/main
|
:target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest/main
|
||||||
@@ -37,15 +37,6 @@
|
|||||||
:target: https://pytest.readthedocs.io/en/latest/?badge=latest
|
:target: https://pytest.readthedocs.io/en/latest/?badge=latest
|
||||||
:alt: Documentation Status
|
:alt: Documentation Status
|
||||||
|
|
||||||
.. image:: https://img.shields.io/badge/Discord-pytest--dev-blue
|
|
||||||
:target: https://discord.com/invite/pytest-dev
|
|
||||||
:alt: Discord
|
|
||||||
|
|
||||||
.. image:: https://img.shields.io/badge/Libera%20chat-%23pytest-orange
|
|
||||||
:target: https://web.libera.chat/#pytest
|
|
||||||
:alt: Libera chat
|
|
||||||
|
|
||||||
|
|
||||||
The ``pytest`` framework makes it easy to write small tests, yet
|
The ``pytest`` framework makes it easy to write small tests, yet
|
||||||
scales to support complex functional testing for applications and libraries.
|
scales to support complex functional testing for applications and libraries.
|
||||||
|
|
||||||
@@ -88,19 +79,19 @@ Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` stat
|
|||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
- Detailed info on failing `assert statements <https://docs.pytest.org/en/stable/how-to/assert.html>`_ (no need to remember ``self.assert*`` names)
|
- Detailed info on failing `assert statements <https://docs.pytest.org/en/stable/assert.html>`_ (no need to remember ``self.assert*`` names)
|
||||||
|
|
||||||
- `Auto-discovery
|
- `Auto-discovery
|
||||||
<https://docs.pytest.org/en/stable/explanation/goodpractices.html#python-test-discovery>`_
|
<https://docs.pytest.org/en/stable/goodpractices.html#python-test-discovery>`_
|
||||||
of test modules and functions
|
of test modules and functions
|
||||||
|
|
||||||
- `Modular fixtures <https://docs.pytest.org/en/stable/explanation/fixtures.html>`_ for
|
- `Modular fixtures <https://docs.pytest.org/en/stable/fixture.html>`_ for
|
||||||
managing small or parametrized long-lived test resources
|
managing small or parametrized long-lived test resources
|
||||||
|
|
||||||
- Can run `unittest <https://docs.pytest.org/en/stable/how-to/unittest.html>`_ (or trial),
|
- Can run `unittest <https://docs.pytest.org/en/stable/unittest.html>`_ (or trial),
|
||||||
`nose <https://docs.pytest.org/en/stable/how-to/nose.html>`_ test suites out of the box
|
`nose <https://docs.pytest.org/en/stable/nose.html>`_ test suites out of the box
|
||||||
|
|
||||||
- Python 3.7+ or PyPy3
|
- Python 3.6+ and PyPy3
|
||||||
|
|
||||||
- Rich plugin architecture, with over 850+ `external plugins <https://docs.pytest.org/en/latest/reference/plugin_list.html>`_ and thriving community
|
- Rich plugin architecture, with over 850+ `external plugins <https://docs.pytest.org/en/latest/reference/plugin_list.html>`_ and thriving community
|
||||||
|
|
||||||
@@ -160,7 +151,7 @@ Tidelift will coordinate the fix and disclosure.
|
|||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Copyright Holger Krekel and others, 2004.
|
Copyright Holger Krekel and others, 2004-2021.
|
||||||
|
|
||||||
Distributed under the terms of the `MIT`_ license, pytest is free and open source software.
|
Distributed under the terms of the `MIT`_ license, pytest is free and open source software.
|
||||||
|
|
||||||
|
|||||||
114
RELEASING.rst
@@ -14,90 +14,60 @@ Preparing: Automatic Method
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
We have developed an automated workflow for releases, that uses GitHub workflows and is triggered
|
We have developed an automated workflow for releases, that uses GitHub workflows and is triggered
|
||||||
by `manually running <https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow>`__
|
by opening an issue.
|
||||||
the `prepare-release-pr workflow <https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml>`__
|
|
||||||
on GitHub Actions.
|
|
||||||
|
|
||||||
The automation will decide the new version number based on the following criteria:
|
Bug-fix releases
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
- If the "major release" input is set to "yes", release a new major release
|
A bug-fix release is always done from a maintenance branch, so for example to release bug-fix
|
||||||
(e.g. 7.0.0 -> 8.0.0)
|
``5.1.2``, open a new issue and add this comment to the body::
|
||||||
- If there are any ``.feature.rst`` or ``.breaking.rst`` files in the
|
|
||||||
``changelog`` directory, release a new minor release (e.g. 7.0.0 -> 7.1.0)
|
|
||||||
- Otherwise, release a bugfix release (e.g. 7.0.0 -> 7.0.1)
|
|
||||||
- If the "prerelease" input is set, append the string to the version number
|
|
||||||
(e.g. 7.0.0 -> 8.0.0rc1), if "major" is set, and "prerelease" is set to `rc1`)
|
|
||||||
|
|
||||||
Bug-fix and minor releases
|
@pytestbot please prepare release from 5.1.x
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Bug-fix and minor releases are always done from a maintenance branch. First,
|
Where ``5.1.x`` is the maintenance branch for the ``5.1`` series.
|
||||||
consider double-checking the ``changelog`` directory to see if there are any
|
|
||||||
breaking changes or new features.
|
|
||||||
|
|
||||||
For a new minor release, first create a new maintenance branch from ``main``::
|
The automated workflow will publish a PR for a branch ``release-5.1.2``
|
||||||
|
and notify it as a comment in the issue.
|
||||||
|
|
||||||
git fetch upstream
|
Minor releases
|
||||||
git branch 7.1.x upstream/main
|
|
||||||
git push upstream 7.1.x
|
|
||||||
|
|
||||||
Then, trigger the workflow with the following inputs:
|
|
||||||
|
|
||||||
- branch: **7.1.x**
|
|
||||||
- major release: **no**
|
|
||||||
- prerelease: empty
|
|
||||||
|
|
||||||
Or via the commandline using `GitHub's cli <https://github.com/cli/cli>`__::
|
|
||||||
|
|
||||||
gh workflow run prepare-release-pr.yml -f branch=7.1.x -f major=no -f prerelease=
|
|
||||||
|
|
||||||
Where ``7.1.x`` is the maintenance branch for the ``7.1`` series. The automated
|
|
||||||
workflow will publish a PR for a branch ``release-7.1.0``.
|
|
||||||
|
|
||||||
Similarly, for a bug-fix release, use the existing maintenance branch and
|
|
||||||
trigger the workflow with e.g. ``branch: 7.0.x`` to get a new ``release-7.0.1``
|
|
||||||
PR.
|
|
||||||
|
|
||||||
Major releases
|
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
1. Create a new maintenance branch from ``main``::
|
1. Create a new maintenance branch from ``main``::
|
||||||
|
|
||||||
git fetch upstream
|
git fetch --all
|
||||||
git branch 8.0.x upstream/main
|
git branch 5.2.x upstream/main
|
||||||
git push upstream 8.0.x
|
git push upstream 5.2.x
|
||||||
|
|
||||||
2. Trigger the workflow with the following inputs:
|
2. Open a new issue and add this comment to the body::
|
||||||
|
|
||||||
- branch: **8.0.x**
|
@pytestbot please prepare release from 5.2.x
|
||||||
- major release: **yes**
|
|
||||||
- prerelease: empty
|
|
||||||
|
|
||||||
Or via the commandline::
|
The automated workflow will publish a PR for a branch ``release-5.2.0`` and
|
||||||
|
notify it as a comment in the issue.
|
||||||
|
|
||||||
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=
|
Major and release candidates
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The automated workflow will publish a PR for a branch ``release-8.0.0``.
|
1. Create a new maintenance branch from ``main``::
|
||||||
|
|
||||||
|
git fetch --all
|
||||||
|
git branch 6.0.x upstream/main
|
||||||
|
git push upstream 6.0.x
|
||||||
|
|
||||||
|
2. For a **major release**, open a new issue and add this comment in the body::
|
||||||
|
|
||||||
|
@pytestbot please prepare major release from 6.0.x
|
||||||
|
|
||||||
|
For a **release candidate**, the comment must be (TODO: `#7551 <https://github.com/pytest-dev/pytest/issues/7551>`__)::
|
||||||
|
|
||||||
|
@pytestbot please prepare release candidate from 6.0.x
|
||||||
|
|
||||||
|
The automated workflow will publish a PR for a branch ``release-6.0.0`` and
|
||||||
|
notify it as a comment in the issue.
|
||||||
|
|
||||||
At this point on, this follows the same workflow as other maintenance branches: bug-fixes are merged
|
At this point on, this follows the same workflow as other maintenance branches: bug-fixes are merged
|
||||||
into ``main`` and ported back to the maintenance branch, even for release candidates.
|
into ``main`` and ported back to the maintenance branch, even for release candidates.
|
||||||
|
|
||||||
Release candidates
|
|
||||||
^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
To release a release candidate, set the "prerelease" input to the version number
|
|
||||||
suffix to use. To release a ``8.0.0rc1``, proceed like under "major releases", but set:
|
|
||||||
|
|
||||||
- branch: 8.0.x
|
|
||||||
- major release: yes
|
|
||||||
- prerelease: **rc1**
|
|
||||||
|
|
||||||
Or via the commandline::
|
|
||||||
|
|
||||||
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=rc1
|
|
||||||
|
|
||||||
The automated workflow will publish a PR for a branch ``release-8.0.0rc1``.
|
|
||||||
|
|
||||||
**A note about release candidates**
|
**A note about release candidates**
|
||||||
|
|
||||||
During release candidates we can merge small improvements into
|
During release candidates we can merge small improvements into
|
||||||
@@ -136,31 +106,29 @@ Both automatic and manual processes described above follow the same steps from t
|
|||||||
#. After all tests pass and the PR has been approved, tag the release commit
|
#. After all tests pass and the PR has been approved, tag the release commit
|
||||||
in the ``release-MAJOR.MINOR.PATCH`` branch and push it. This will publish to PyPI::
|
in the ``release-MAJOR.MINOR.PATCH`` branch and push it. This will publish to PyPI::
|
||||||
|
|
||||||
git fetch upstream
|
git fetch --all
|
||||||
git tag MAJOR.MINOR.PATCH upstream/release-MAJOR.MINOR.PATCH
|
git tag MAJOR.MINOR.PATCH upstream/release-MAJOR.MINOR.PATCH
|
||||||
git push upstream MAJOR.MINOR.PATCH
|
git push git@github.com:pytest-dev/pytest.git MAJOR.MINOR.PATCH
|
||||||
|
|
||||||
Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.
|
Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.
|
||||||
|
|
||||||
#. Merge the PR. **Make sure it's not squash-merged**, so that the tagged commit ends up in the main branch.
|
#. Merge the PR.
|
||||||
|
|
||||||
#. Cherry-pick the CHANGELOG / announce files to the ``main`` branch::
|
#. Cherry-pick the CHANGELOG / announce files to the ``main`` branch::
|
||||||
|
|
||||||
git fetch upstream
|
git fetch --all --prune
|
||||||
git checkout upstream/main -b cherry-pick-release
|
git checkout upstream/main -b cherry-pick-release
|
||||||
git cherry-pick -x -m1 upstream/MAJOR.MINOR.x
|
git cherry-pick -x -m1 upstream/MAJOR.MINOR.x
|
||||||
|
|
||||||
#. Open a PR for ``cherry-pick-release`` and merge it once CI passes. No need to wait for approvals if there were no conflicts on the previous step.
|
#. Open a PR for ``cherry-pick-release`` and merge it once CI passes. No need to wait for approvals if there were no conflicts on the previous step.
|
||||||
|
|
||||||
#. For major and minor releases (or the first prerelease of it), tag the release cherry-pick merge commit in main with
|
#. For major and minor releases, tag the release cherry-pick merge commit in main with
|
||||||
a dev tag for the next feature release::
|
a dev tag for the next feature release::
|
||||||
|
|
||||||
git checkout main
|
git checkout main
|
||||||
git pull
|
git pull
|
||||||
git tag MAJOR.{MINOR+1}.0.dev0
|
git tag MAJOR.{MINOR+1}.0.dev0
|
||||||
git push upstream MAJOR.{MINOR+1}.0.dev0
|
git push git@github.com:pytest-dev/pytest.git MAJOR.{MINOR+1}.0.dev0
|
||||||
|
|
||||||
#. For major and minor releases, change the default version in the `Read the Docs Settings <https://readthedocs.org/dashboard/pytest/advanced/>`_ to the new branch.
|
|
||||||
|
|
||||||
#. Send an email announcement with the contents from::
|
#. Send an email announcement with the contents from::
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
If multiple errors are raised in teardown, we now re-raise an ``ExceptionGroup`` of them instead of discarding all but the last.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix 'importlib.abc.TraversableResources' deprecation warning in Python 3.12.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
If a test is skipped from inside a fixture, the test summary now shows the test location instead of the fixture location.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix bug where sometimes pytest would use the file system root directory as :ref:`rootdir <rootdir>` on Windows.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Test methods decorated with ``@classmethod`` can now be discovered as tests, following the same rules as normal methods. This fills the gap that static methods were discoverable as tests but not class methods.
|
|
||||||
1
changelog/5105.doc.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Add automatically generated :ref:`plugin-list`. The list is updated on a periodic schedule.
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
The full output of a test is no longer truncated if the truncation message would be longer than
|
|
||||||
the hidden text. The line number shown has also been fixed.
|
|
||||||
7
changelog/7259.feature.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Added :meth:`cache.mkdir() <pytest.Cache.mkdir>`, which is similar to the existing :meth:`cache.makedir() <pytest.Cache.makedir>`,
|
||||||
|
but returns a :class:`pathlib.Path` instead of a legacy ``py.path.local``.
|
||||||
|
|
||||||
|
Added a ``paths`` type to :meth:`parser.addini() <pytest.Parser.addini>`,
|
||||||
|
as in ``parser.addini("mypaths", "my paths", type="paths")``,
|
||||||
|
which is similar to the existing ``pathlist``,
|
||||||
|
but returns a list of :class:`pathlib.Path` instead of legacy ``py.path.local``.
|
||||||
@@ -1 +0,0 @@
|
|||||||
``--log-disable`` CLI option added to disable individual loggers.
|
|
||||||
12
changelog/7469.deprecation.rst
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Directly constructing the following classes is now deprecated:
|
||||||
|
|
||||||
|
- ``_pytest.mark.structures.Mark``
|
||||||
|
- ``_pytest.mark.structures.MarkDecorator``
|
||||||
|
- ``_pytest.mark.structures.MarkGenerator``
|
||||||
|
- ``_pytest.python.Metafunc``
|
||||||
|
- ``_pytest.runner.CallInfo``
|
||||||
|
- ``_pytest._code.ExceptionInfo``
|
||||||
|
- ``_pytest.config.argparsing.Parser``
|
||||||
|
- ``_pytest.config.argparsing.OptionGroup``
|
||||||
|
|
||||||
|
These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.
|
||||||
19
changelog/7469.feature.rst
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
The types of objects used in pytest's API are now exported so they may be used in type annotations.
|
||||||
|
|
||||||
|
The newly-exported types are:
|
||||||
|
|
||||||
|
- ``pytest.Config`` for :class:`Config <pytest.Config>`.
|
||||||
|
- ``pytest.Mark`` for :class:`marks <pytest.Mark>`.
|
||||||
|
- ``pytest.MarkDecorator`` for :class:`mark decorators <pytest.MarkDecorator>`.
|
||||||
|
- ``pytest.MarkGenerator`` for the :class:`pytest.mark <pytest.MarkGenerator>` singleton.
|
||||||
|
- ``pytest.Metafunc`` for the :class:`metafunc <pytest.MarkGenerator>` argument to the :func:`pytest_generate_tests <pytest.hookspec.pytest_generate_tests>` hook.
|
||||||
|
- ``pytest.CallInfo`` for the :class:`CallInfo <pytest.CallInfo>` type passed to various hooks.
|
||||||
|
- ``pytest.PytestPluginManager`` for :class:`PytestPluginManager <pytest.PytestPluginManager>`.
|
||||||
|
- ``pytest.ExceptionInfo`` for the :class:`ExceptionInfo <pytest.ExceptionInfo>` type returned from :func:`pytest.raises` and passed to various hooks.
|
||||||
|
- ``pytest.Parser`` for the :class:`Parser <pytest.Parser>` type passed to the :func:`pytest_addoption <pytest.hookspec.pytest_addoption>` hook.
|
||||||
|
- ``pytest.OptionGroup`` for the :class:`OptionGroup <pytest.OptionGroup>` type returned from the :func:`parser.addgroup <pytest.Parser.getgroup>` method.
|
||||||
|
|
||||||
|
Constructing them directly is not supported; they are only meant for use in type annotations.
|
||||||
|
Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.
|
||||||
|
|
||||||
|
Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.
|
||||||
2
changelog/7856.feature.rst
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
:ref:`--import-mode=importlib <import-modes>` now works with features that
|
||||||
|
depend on modules being on :py:data:`sys.modules`, such as :mod:`pickle` and :mod:`dataclasses`.
|
||||||
1
changelog/8061.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Fixed failing staticmethod test cases if they are inherited from a parent test class.
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
Added :confval:`tmp_path_retention_count` and :confval:`tmp_path_retention_policy` configuration options to control how directories created by the :fixture:`tmp_path` fixture are kept.
|
|
||||||
The default behavior has changed to keep only directories for failed tests, equivalent to `tmp_path_retention_policy="failed"`.
|
|
||||||
7
changelog/8144.feature.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
The following hooks now receive an additional ``pathlib.Path`` argument, equivalent to an existing ``py.path.local`` argument:
|
||||||
|
|
||||||
|
- :func:`pytest_ignore_collect <_pytest.hookspec.pytest_ignore_collect>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
|
||||||
|
- :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
|
||||||
|
- :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
|
||||||
|
- :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter).
|
||||||
|
- :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter).
|
||||||
6
changelog/8174.trivial.rst
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
The following changes have been made to internal pytest types/functions:
|
||||||
|
|
||||||
|
- The ``path`` property of ``_pytest.code.Code`` returns ``Path`` instead of ``py.path.local``.
|
||||||
|
- The ``path`` property of ``_pytest.code.TracebackEntry`` returns ``Path`` instead of ``py.path.local``.
|
||||||
|
- The ``_pytest.code.getfslineno()`` function returns ``Path`` instead of ``py.path.local``.
|
||||||
|
- The ``_pytest.python.path_matches_patterns()`` function takes ``Path`` instead of ``py.path.local``.
|
||||||
3
changelog/8192.bugfix.rst
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
``testdir.makefile`` now silently accepts values which don't start with ``.`` to maintain backward compatibility with older pytest versions.
|
||||||
|
|
||||||
|
``pytester.makefile`` now issues a clearer error if the ``.`` is missing in the ``ext`` argument.
|
||||||
7
changelog/8242.deprecation.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Raising :class:`unittest.SkipTest` to skip collection of tests during the
|
||||||
|
pytest collection phase is deprecated. Use :func:`pytest.skip` instead.
|
||||||
|
|
||||||
|
Note: This deprecation only relates to using `unittest.SkipTest` during test
|
||||||
|
collection. You are probably not doing that. Ordinary usage of
|
||||||
|
:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` /
|
||||||
|
:func:`unittest.skip` in unittest test cases is fully supported.
|
||||||
1
changelog/8248.trivial.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Internal Restructure: let python.PyObjMixing inherit from nodes.Node to carry over typing information.
|
||||||
1
changelog/8251.deprecation.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Deprecate ``Node.fspath`` as we plan to move off `py.path.local <https://py.readthedocs.io/en/latest/path.html>`__ and switch to :mod:``pathlib``.
|
||||||
1
changelog/8251.feature.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Implement ``Node.path`` as a ``pathlib.Path``.
|
||||||
3
changelog/8258.bugfix.rst
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Fixed issue where pytest's ``faulthandler`` support would not dump traceback on crashes
|
||||||
|
if the :mod:`faulthandler` module was already enabled during pytest startup (using
|
||||||
|
``python -X dev -m pytest`` for example).
|
||||||
5
changelog/8315.deprecation.rst
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
|
||||||
|
scheduled for removal in pytest 7 (deprecated since pytest 2.4.0):
|
||||||
|
|
||||||
|
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
|
||||||
|
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.
|
||||||
1
changelog/8317.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Fixed an issue where illegal directory characters derived from ``getpass.getuser()`` raised an ``OSError``.
|
||||||
10
changelog/8335.improvement.rst
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Improved :func:`pytest.approx` assertion messages for sequences of numbers.
|
||||||
|
|
||||||
|
The assertion messages now dumps a table with the index and the error of each diff.
|
||||||
|
Example::
|
||||||
|
|
||||||
|
> assert [1, 2, 3, 4] == pytest.approx([1, 3, 3, 5])
|
||||||
|
E assert comparison failed for 2 values:
|
||||||
|
E Index | Obtained | Expected
|
||||||
|
E 1 | 2 | 3 +- 3.0e-06
|
||||||
|
E 3 | 4 | 5 +- 5.0e-06
|
||||||
1
changelog/8337.doc.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Recommend `numpy.testing <https://numpy.org/doc/stable/reference/routines.testing.html>`__ module on :func:`pytest.approx` documentation.
|
||||||
1
changelog/8367.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Fix ``Class.from_parent`` so it forwards extra keyword arguments to the constructor.
|
||||||
1
changelog/8384.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
The ``@pytest.mark.skip`` decorator now correctly handles its arguments. When the ``reason`` argument is accidentally given both positional and as a keyword (e.g. because it was confused with ``skipif``), a ``TypeError`` now occurs. Before, such tests were silently skipped, and the positional argument ignored. Additionally, ``reason`` is now documented correctly as positional or keyword (rather than keyword-only).
|
||||||
1
changelog/8394.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Use private names for internal fixtures that handle classic setup/teardown so that they don't show up with the default ``--fixtures`` invocation (but they still show up with ``--fixtures -v``).
|
||||||
5
changelog/8403.improvement.rst
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
By default, pytest will truncate long strings in assert errors so they don't clutter the output too much,
|
||||||
|
currently at ``240`` characters by default.
|
||||||
|
|
||||||
|
However, in some cases the longer output helps, or is even crucial, to diagnose a failure. Using ``-v`` will
|
||||||
|
now increase the truncation threshold to ``2400`` characters, and ``-vv`` or higher will disable truncation entirely.
|
||||||
1
changelog/8411.trivial.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Assert the outcomes for the issue 518 test and fix the test.
|
||||||
1
changelog/8421.feature.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
:func:`pytest.approx` now works on :class:`~decimal.Decimal` within mappings/dicts and sequences/lists.
|
||||||
1
changelog/8456.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
The :confval:`required_plugins` config option now works correctly when pre-releases of plugins are installed, rather than falsely claiming that those plugins aren't installed at all.
|
||||||
1
changelog/8464.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
``-c <config file>`` now also properly defines ``rootdir`` as the directory that contains ``<config file>``.
|
||||||
1
changelog/8494.feature.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Python 3.10 is now supported.
|
||||||
4
changelog/8503.trivial.rst
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
:meth:`pytest.MonkeyPatch.syspath_prepend` no longer fails when
|
||||||
|
``setuptools`` is not installed.
|
||||||
|
It now only calls :func:`pkg_resources.fixup_namespace_packages` if
|
||||||
|
``pkg_resources`` was previously imported, because it is not needed otherwise.
|
||||||
5
changelog/8509.improvement.rst
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Fixed issue where `TestCase.setUpClass` is not called when a test has `/` in its name since pytest 6.2.0.
|
||||||
|
|
||||||
|
This refers to the path part in pytest node IDs, e.g. `TestClass::test_it` in the node ID `tests/test_file.py::TestClass::test_it`.
|
||||||
|
|
||||||
|
Now, instead of assuming that the test name does not contain ``/``, it is assumed that test path does not contain ``::``. We plan to hopefully make both of these work in the future.
|
||||||
1
changelog/8548.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Introduce fix to handle precision width in ``log-cli-format`` in turn to fix output coloring for certain formats.
|
||||||
5
changelog/8606.feature.rst
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
pytest invocations with ``--fixtures-per-test`` and ``--fixtures`` have been enabled with:
|
||||||
|
|
||||||
|
- Fixture location path printed with the fixture name.
|
||||||
|
- First section of the fixture's docstring printed under the fixture name.
|
||||||
|
- Whole of fixture's docstring printed under the fixture name using ``--verbose`` option.
|
||||||
4
changelog/8645.improvement.rst
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Reducing confusion from `pytest.warns(None)` by:
|
||||||
|
|
||||||
|
- Allowing no arguments to be passed in order to catch any exception (no argument defaults to `Warning`).
|
||||||
|
- Emit a deprecation warning if passed `None`.
|
||||||
1
changelog/8655.doc.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Help text for ``--pdbcls`` more accurately reflects the option's behavior.
|
||||||
1
changelog/8761.feature.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
New :ref:`version-tuple` attribute, which makes it simpler for users to do something depending on the pytest version (such as declaring hooks which are introduced in later versions).
|
||||||
@@ -34,10 +34,6 @@ REGENDOC_ARGS := \
|
|||||||
|
|
||||||
regen: REGENDOC_FILES:=*.rst */*.rst
|
regen: REGENDOC_FILES:=*.rst */*.rst
|
||||||
regen:
|
regen:
|
||||||
# need to reset cachedir to the non-tox default
|
PYTHONDONTWRITEBYTECODE=1 PYTEST_ADDOPTS="-pno:hypothesis -Wignore::pytest.PytestUnknownMarkWarning" COLUMNS=76 regendoc --update ${REGENDOC_FILES} ${REGENDOC_ARGS}
|
||||||
PYTHONDONTWRITEBYTECODE=1 \
|
|
||||||
PYTEST_ADDOPTS="-pno:hypothesis -p no:hypothesispytest -Wignore::pytest.PytestUnknownMarkWarning -o cache_dir=.pytest_cache" \
|
|
||||||
COLUMNS=76 \
|
|
||||||
regendoc --update ${REGENDOC_FILES} ${REGENDOC_ARGS}
|
|
||||||
|
|
||||||
.PHONY: regen
|
.PHONY: regen
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<li><a href="{{ pathto('changelog') }}">Changelog</a></li>
|
<li><a href="{{ pathto('changelog') }}">Changelog</a></li>
|
||||||
<li><a href="{{ pathto('contributing') }}">Contributing</a></li>
|
<li><a href="{{ pathto('contributing') }}">Contributing</a></li>
|
||||||
<li><a href="{{ pathto('backwards-compatibility') }}">Backwards Compatibility</a></li>
|
<li><a href="{{ pathto('backwards-compatibility') }}">Backwards Compatibility</a></li>
|
||||||
|
<li><a href="{{ pathto('py27-py34-deprecation') }}">Python 2.7 and 3.4 Support</a></li>
|
||||||
<li><a href="{{ pathto('sponsor') }}">Sponsor</a></li>
|
<li><a href="{{ pathto('sponsor') }}">Sponsor</a></li>
|
||||||
<li><a href="{{ pathto('tidelift') }}">pytest for Enterprise</a></li>
|
<li><a href="{{ pathto('tidelift') }}">pytest for Enterprise</a></li>
|
||||||
<li><a href="{{ pathto('license') }}">License</a></li>
|
<li><a href="{{ pathto('license') }}">License</a></li>
|
||||||
@@ -29,3 +30,5 @@
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
<a href="{{ pathto('genindex') }}">Index</a>
|
||||||
|
<hr>
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ Are you an enthusiastic pytest user, the local testing guru in your workplace? O
|
|||||||
|
|
||||||
We will pair experienced pytest users with open source projects, for a month's effort of getting new development teams started with pytest.
|
We will pair experienced pytest users with open source projects, for a month's effort of getting new development teams started with pytest.
|
||||||
|
|
||||||
In 2015 we are trying this for the first time. In February and March 2015 we will gather volunteers on both sides, in April we will do the work, and in May we will evaluate how it went. This effort is being coordinated by Brianna Laugher. If you have any questions or comments, you can raise them on the `@pytestdotorg twitter account <https://twitter.com/pytestdotorg>`_\, the :issue:`issue tracker <676>` or the `pytest-dev mailing list`_.
|
In 2015 we are trying this for the first time. In February and March 2015 we will gather volunteers on both sides, in April we will do the work, and in May we will evaluate how it went. This effort is being coordinated by Brianna Laugher. If you have any questions or comments, you can raise them on the `@pytestdotorg twitter account <https://twitter.com/pytestdotorg>`_ the `issue tracker`_ or the `pytest-dev mailing list`_.
|
||||||
|
|
||||||
|
|
||||||
|
.. _`issue tracker`: https://github.com/pytest-dev/pytest/issues/676
|
||||||
.. _`pytest-dev mailing list`: https://mail.python.org/mailman/listinfo/pytest-dev
|
.. _`pytest-dev mailing list`: https://mail.python.org/mailman/listinfo/pytest-dev
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,6 @@ Release announcements
|
|||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
|
||||||
release-7.2.0
|
|
||||||
release-7.1.3
|
|
||||||
release-7.1.2
|
|
||||||
release-7.1.1
|
|
||||||
release-7.1.0
|
|
||||||
release-7.0.1
|
|
||||||
release-7.0.0
|
|
||||||
release-7.0.0rc1
|
|
||||||
release-6.2.5
|
|
||||||
release-6.2.4
|
release-6.2.4
|
||||||
release-6.2.3
|
release-6.2.3
|
||||||
release-6.2.2
|
release-6.2.2
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ New Features
|
|||||||
|
|
||||||
import pytest ; pytest.main(arglist, pluginlist)
|
import pytest ; pytest.main(arglist, pluginlist)
|
||||||
|
|
||||||
see http://pytest.org/en/stable/how-to/usage.html for details.
|
see http://pytest.org/en/stable/usage.html for details.
|
||||||
|
|
||||||
- new and better reporting information in assert expressions
|
- new and better reporting information in assert expressions
|
||||||
if comparing lists, sequences or strings.
|
if comparing lists, sequences or strings.
|
||||||
|
|
||||||
see http://pytest.org/en/stable/how-to/assert.html#newreport
|
see http://pytest.org/en/stable/assert.html#newreport
|
||||||
|
|
||||||
- new configuration through ini-files (setup.cfg or tox.ini recognized),
|
- new configuration through ini-files (setup.cfg or tox.ini recognized),
|
||||||
for example::
|
for example::
|
||||||
@@ -50,7 +50,7 @@ New Features
|
|||||||
norecursedirs = .hg data* # don't ever recurse in such dirs
|
norecursedirs = .hg data* # don't ever recurse in such dirs
|
||||||
addopts = -x --pyargs # add these command line options by default
|
addopts = -x --pyargs # add these command line options by default
|
||||||
|
|
||||||
see http://pytest.org/en/stable/reference/customize.html
|
see http://pytest.org/en/stable/customize.html
|
||||||
|
|
||||||
- improved standard unittest support. In general py.test should now
|
- improved standard unittest support. In general py.test should now
|
||||||
better be able to run custom unittest.TestCases like twisted trial
|
better be able to run custom unittest.TestCases like twisted trial
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ Changes between 2.0.0 and 2.0.1
|
|||||||
- refinements to "collecting" output on non-ttys
|
- refinements to "collecting" output on non-ttys
|
||||||
- refine internal plugin registration and --traceconfig output
|
- refine internal plugin registration and --traceconfig output
|
||||||
- introduce a mechanism to prevent/unregister plugins from the
|
- introduce a mechanism to prevent/unregister plugins from the
|
||||||
command line, see http://pytest.org/en/stable/how-to/plugins.html#cmdunregister
|
command line, see http://pytest.org/en/stable/plugins.html#cmdunregister
|
||||||
- activate resultlog plugin by default
|
- activate resultlog plugin by default
|
||||||
- fix regression wrt yielded tests which due to the
|
- fix regression wrt yielded tests which due to the
|
||||||
collection-before-running semantics were not
|
collection-before-running semantics were not
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ courtesy of Benjamin Peterson. You can now safely use ``assert``
|
|||||||
statements in test modules without having to worry about side effects
|
statements in test modules without having to worry about side effects
|
||||||
or python optimization ("-OO") options. This is achieved by rewriting
|
or python optimization ("-OO") options. This is achieved by rewriting
|
||||||
assert statements in test modules upon import, using a PEP302 hook.
|
assert statements in test modules upon import, using a PEP302 hook.
|
||||||
See https://docs.pytest.org/en/stable/how-to/assert.html for
|
See https://docs.pytest.org/en/stable/assert.html for
|
||||||
detailed information. The work has been partly sponsored by my company,
|
detailed information. The work has been partly sponsored by my company,
|
||||||
merlinux GmbH.
|
merlinux GmbH.
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ with these improvements:
|
|||||||
|
|
||||||
- new @pytest.mark.parametrize decorator to run tests with different arguments
|
- new @pytest.mark.parametrize decorator to run tests with different arguments
|
||||||
- new metafunc.parametrize() API for parametrizing arguments independently
|
- new metafunc.parametrize() API for parametrizing arguments independently
|
||||||
- see examples at http://pytest.org/en/stable/example/how-to/parametrize.html
|
- see examples at http://pytest.org/en/stable/example/parametrize.html
|
||||||
- NOTE that parametrize() related APIs are still a bit experimental
|
- NOTE that parametrize() related APIs are still a bit experimental
|
||||||
and might change in future releases.
|
and might change in future releases.
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ Changes between 2.1.3 and 2.2.0
|
|||||||
or through plugin hooks. Also introduce a "--strict" option which
|
or through plugin hooks. Also introduce a "--strict" option which
|
||||||
will treat unregistered markers as errors
|
will treat unregistered markers as errors
|
||||||
allowing to avoid typos and maintain a well described set of markers
|
allowing to avoid typos and maintain a well described set of markers
|
||||||
for your test suite. See examples at http://pytest.org/en/stable/how-to/mark.html
|
for your test suite. See examples at http://pytest.org/en/stable/mark.html
|
||||||
and its links.
|
and its links.
|
||||||
- issue50: introduce "-m marker" option to select tests based on markers
|
- issue50: introduce "-m marker" option to select tests based on markers
|
||||||
(this is a stricter and more predictable version of "-k" in that "-m"
|
(this is a stricter and more predictable version of "-k" in that "-m"
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ re-usable fixture design.
|
|||||||
|
|
||||||
For detailed info and tutorial-style examples, see:
|
For detailed info and tutorial-style examples, see:
|
||||||
|
|
||||||
http://pytest.org/en/stable/explanation/fixtures.html
|
http://pytest.org/en/stable/fixture.html
|
||||||
|
|
||||||
Moreover, there is now support for using pytest fixtures/funcargs with
|
Moreover, there is now support for using pytest fixtures/funcargs with
|
||||||
unittest-style suites, see here for examples:
|
unittest-style suites, see here for examples:
|
||||||
|
|
||||||
http://pytest.org/en/stable/how-to/unittest.html
|
http://pytest.org/en/stable/unittest.html
|
||||||
|
|
||||||
Besides, more unittest-test suites are now expected to "simply work"
|
Besides, more unittest-test suites are now expected to "simply work"
|
||||||
with pytest.
|
with pytest.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ comes with the following fixes and features:
|
|||||||
- yielded test functions will now have autouse-fixtures active but
|
- yielded test functions will now have autouse-fixtures active but
|
||||||
cannot accept fixtures as funcargs - it's anyway recommended to
|
cannot accept fixtures as funcargs - it's anyway recommended to
|
||||||
rather use the post-2.0 parametrize features instead of yield, see:
|
rather use the post-2.0 parametrize features instead of yield, see:
|
||||||
http://pytest.org/en/stable/example/how-to/parametrize.html
|
http://pytest.org/en/stable/example/parametrize.html
|
||||||
- fix autouse-issue where autouse-fixtures would not be discovered
|
- fix autouse-issue where autouse-fixtures would not be discovered
|
||||||
if defined in an a/conftest.py file and tests in a/tests/test_some.py
|
if defined in an a/conftest.py file and tests in a/tests/test_some.py
|
||||||
- fix issue226 - LIFO ordering for fixture teardowns
|
- fix issue226 - LIFO ordering for fixture teardowns
|
||||||
|
|||||||
@@ -23,13 +23,14 @@ a full list of details. A few feature highlights:
|
|||||||
called if the corresponding setup method succeeded.
|
called if the corresponding setup method succeeded.
|
||||||
|
|
||||||
- integrate tab-completion on command line options if you
|
- integrate tab-completion on command line options if you
|
||||||
have :pypi:`argcomplete` configured.
|
have `argcomplete <https://pypi.org/project/argcomplete/>`_
|
||||||
|
configured.
|
||||||
|
|
||||||
- allow boolean expression directly with skipif/xfail
|
- allow boolean expression directly with skipif/xfail
|
||||||
if a "reason" is also specified.
|
if a "reason" is also specified.
|
||||||
|
|
||||||
- a new hook ``pytest_load_initial_conftests`` allows plugins like
|
- a new hook ``pytest_load_initial_conftests`` allows plugins like
|
||||||
:pypi:`pytest-django` to
|
`pytest-django <https://pypi.org/project/pytest-django/>`_ to
|
||||||
influence the environment before conftest files import ``django``.
|
influence the environment before conftest files import ``django``.
|
||||||
|
|
||||||
- reporting: color the last line red or green depending if
|
- reporting: color the last line red or green depending if
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ clear information about the circumstances and a simple example which
|
|||||||
reproduces the problem.
|
reproduces the problem.
|
||||||
|
|
||||||
The issue tracker is of course not empty now. We have many remaining
|
The issue tracker is of course not empty now. We have many remaining
|
||||||
"enhancement" issues which we'll hopefully can tackle in 2014 with your
|
"enhacement" issues which we'll hopefully can tackle in 2014 with your
|
||||||
help.
|
help.
|
||||||
|
|
||||||
For those who use older Python versions, please note that pytest is not
|
For those who use older Python versions, please note that pytest is not
|
||||||
|
|||||||
@@ -45,29 +45,29 @@ The py.test Development Team
|
|||||||
**New Features**
|
**New Features**
|
||||||
|
|
||||||
* New ``pytest.mark.skip`` mark, which unconditionally skips marked tests.
|
* New ``pytest.mark.skip`` mark, which unconditionally skips marked tests.
|
||||||
Thanks :user:`MichaelAquilina` for the complete PR (:pull:`1040`).
|
Thanks `@MichaelAquilina`_ for the complete PR (`#1040`_).
|
||||||
|
|
||||||
* ``--doctest-glob`` may now be passed multiple times in the command-line.
|
* ``--doctest-glob`` may now be passed multiple times in the command-line.
|
||||||
Thanks :user:`jab` and :user:`nicoddemus` for the PR.
|
Thanks `@jab`_ and `@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
* New ``-rp`` and ``-rP`` reporting options give the summary and full output
|
* New ``-rp`` and ``-rP`` reporting options give the summary and full output
|
||||||
of passing tests, respectively. Thanks to :user:`codewarrior0` for the PR.
|
of passing tests, respectively. Thanks to `@codewarrior0`_ for the PR.
|
||||||
|
|
||||||
* ``pytest.mark.xfail`` now has a ``strict`` option which makes ``XPASS``
|
* ``pytest.mark.xfail`` now has a ``strict`` option which makes ``XPASS``
|
||||||
tests to fail the test suite, defaulting to ``False``. There's also a
|
tests to fail the test suite, defaulting to ``False``. There's also a
|
||||||
``xfail_strict`` ini option that can be used to configure it project-wise.
|
``xfail_strict`` ini option that can be used to configure it project-wise.
|
||||||
Thanks :user:`rabbbit` for the request and :user:`nicoddemus` for the PR (:issue:`1355`).
|
Thanks `@rabbbit`_ for the request and `@nicoddemus`_ for the PR (`#1355`_).
|
||||||
|
|
||||||
* ``Parser.addini`` now supports options of type ``bool``. Thanks
|
* ``Parser.addini`` now supports options of type ``bool``. Thanks
|
||||||
:user:`nicoddemus` for the PR.
|
`@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
* New ``ALLOW_BYTES`` doctest option strips ``b`` prefixes from byte strings
|
* New ``ALLOW_BYTES`` doctest option strips ``b`` prefixes from byte strings
|
||||||
in doctest output (similar to ``ALLOW_UNICODE``).
|
in doctest output (similar to ``ALLOW_UNICODE``).
|
||||||
Thanks :user:`jaraco` for the request and :user:`nicoddemus` for the PR (:issue:`1287`).
|
Thanks `@jaraco`_ for the request and `@nicoddemus`_ for the PR (`#1287`_).
|
||||||
|
|
||||||
* give a hint on KeyboardInterrupt to use the --fulltrace option to show the errors,
|
* give a hint on KeyboardInterrupt to use the --fulltrace option to show the errors,
|
||||||
this fixes :issue:`1366`.
|
this fixes `#1366`_.
|
||||||
Thanks to :user:`hpk42` for the report and :user:`RonnyPfannschmidt` for the PR.
|
Thanks to `@hpk42`_ for the report and `@RonnyPfannschmidt`_ for the PR.
|
||||||
|
|
||||||
* catch IndexError exceptions when getting exception source location. This fixes
|
* catch IndexError exceptions when getting exception source location. This fixes
|
||||||
pytest internal error for dynamically generated code (fixtures and tests)
|
pytest internal error for dynamically generated code (fixtures and tests)
|
||||||
@@ -91,44 +91,69 @@ The py.test Development Team
|
|||||||
`pylib <https://pylib.readthedocs.io/en/stable/>`_.
|
`pylib <https://pylib.readthedocs.io/en/stable/>`_.
|
||||||
|
|
||||||
* ``pytest_enter_pdb`` now optionally receives the pytest config object.
|
* ``pytest_enter_pdb`` now optionally receives the pytest config object.
|
||||||
Thanks :user:`nicoddemus` for the PR.
|
Thanks `@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
* Removed code and documentation for Python 2.5 or lower versions,
|
* Removed code and documentation for Python 2.5 or lower versions,
|
||||||
including removal of the obsolete ``_pytest.assertion.oldinterpret`` module.
|
including removal of the obsolete ``_pytest.assertion.oldinterpret`` module.
|
||||||
Thanks :user:`nicoddemus` for the PR (:issue:`1226`).
|
Thanks `@nicoddemus`_ for the PR (`#1226`_).
|
||||||
|
|
||||||
* Comparisons now always show up in full when ``CI`` or ``BUILD_NUMBER`` is
|
* Comparisons now always show up in full when ``CI`` or ``BUILD_NUMBER`` is
|
||||||
found in the environment, even when -vv isn't used.
|
found in the environment, even when -vv isn't used.
|
||||||
Thanks :user:`The-Compiler` for the PR.
|
Thanks `@The-Compiler`_ for the PR.
|
||||||
|
|
||||||
* ``--lf`` and ``--ff`` now support long names: ``--last-failed`` and
|
* ``--lf`` and ``--ff`` now support long names: ``--last-failed`` and
|
||||||
``--failed-first`` respectively.
|
``--failed-first`` respectively.
|
||||||
Thanks :user:`MichaelAquilina` for the PR.
|
Thanks `@MichaelAquilina`_ for the PR.
|
||||||
|
|
||||||
* Added expected exceptions to pytest.raises fail message
|
* Added expected exceptions to pytest.raises fail message
|
||||||
|
|
||||||
* Collection only displays progress ("collecting X items") when in a terminal.
|
* Collection only displays progress ("collecting X items") when in a terminal.
|
||||||
This avoids cluttering the output when using ``--color=yes`` to obtain
|
This avoids cluttering the output when using ``--color=yes`` to obtain
|
||||||
colors in CI integrations systems (:issue:`1397`).
|
colors in CI integrations systems (`#1397`_).
|
||||||
|
|
||||||
**Bug Fixes**
|
**Bug Fixes**
|
||||||
|
|
||||||
* The ``-s`` and ``-c`` options should now work under ``xdist``;
|
* The ``-s`` and ``-c`` options should now work under ``xdist``;
|
||||||
``Config.fromdictargs`` now represents its input much more faithfully.
|
``Config.fromdictargs`` now represents its input much more faithfully.
|
||||||
Thanks to :user:`bukzor` for the complete PR (:issue:`680`).
|
Thanks to `@bukzor`_ for the complete PR (`#680`_).
|
||||||
|
|
||||||
* Fix (:issue:`1290`): support Python 3.5's ``@`` operator in assertion rewriting.
|
* Fix (`#1290`_): support Python 3.5's ``@`` operator in assertion rewriting.
|
||||||
Thanks :user:`Shinkenjoe` for report with test case and :user:`tomviner` for the PR.
|
Thanks `@Shinkenjoe`_ for report with test case and `@tomviner`_ for the PR.
|
||||||
|
|
||||||
* Fix formatting utf-8 explanation messages (:issue:`1379`).
|
* Fix formatting utf-8 explanation messages (`#1379`_).
|
||||||
Thanks :user:`biern` for the PR.
|
Thanks `@biern`_ for the PR.
|
||||||
|
|
||||||
* Fix `traceback style docs`_ to describe all of the available options
|
* Fix `traceback style docs`_ to describe all of the available options
|
||||||
(auto/long/short/line/native/no), with ``auto`` being the default since v2.6.
|
(auto/long/short/line/native/no), with ``auto`` being the default since v2.6.
|
||||||
Thanks :user:`hackebrot` for the PR.
|
Thanks `@hackebrot`_ for the PR.
|
||||||
|
|
||||||
* Fix (:issue:`1422`): junit record_xml_property doesn't allow multiple records
|
* Fix (`#1422`_): junit record_xml_property doesn't allow multiple records
|
||||||
with same name.
|
with same name.
|
||||||
|
|
||||||
|
|
||||||
.. _`traceback style docs`: https://pytest.org/en/stable/how-to/output.html#modifying-python-traceback-printing
|
.. _`traceback style docs`: https://pytest.org/en/stable/usage.html#modifying-python-traceback-printing
|
||||||
|
|
||||||
|
.. _#1422: https://github.com/pytest-dev/pytest/issues/1422
|
||||||
|
.. _#1379: https://github.com/pytest-dev/pytest/issues/1379
|
||||||
|
.. _#1366: https://github.com/pytest-dev/pytest/issues/1366
|
||||||
|
.. _#1040: https://github.com/pytest-dev/pytest/pull/1040
|
||||||
|
.. _#680: https://github.com/pytest-dev/pytest/issues/680
|
||||||
|
.. _#1287: https://github.com/pytest-dev/pytest/pull/1287
|
||||||
|
.. _#1226: https://github.com/pytest-dev/pytest/pull/1226
|
||||||
|
.. _#1290: https://github.com/pytest-dev/pytest/pull/1290
|
||||||
|
.. _#1355: https://github.com/pytest-dev/pytest/pull/1355
|
||||||
|
.. _#1397: https://github.com/pytest-dev/pytest/issues/1397
|
||||||
|
.. _@biern: https://github.com/biern
|
||||||
|
.. _@MichaelAquilina: https://github.com/MichaelAquilina
|
||||||
|
.. _@bukzor: https://github.com/bukzor
|
||||||
|
.. _@hpk42: https://github.com/hpk42
|
||||||
|
.. _@nicoddemus: https://github.com/nicoddemus
|
||||||
|
.. _@jab: https://github.com/jab
|
||||||
|
.. _@codewarrior0: https://github.com/codewarrior0
|
||||||
|
.. _@jaraco: https://github.com/jaraco
|
||||||
|
.. _@The-Compiler: https://github.com/The-Compiler
|
||||||
|
.. _@Shinkenjoe: https://github.com/Shinkenjoe
|
||||||
|
.. _@tomviner: https://github.com/tomviner
|
||||||
|
.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
|
||||||
|
.. _@rabbbit: https://github.com/rabbbit
|
||||||
|
.. _@hackebrot: https://github.com/hackebrot
|
||||||
|
|||||||
@@ -37,21 +37,31 @@ The py.test Development Team
|
|||||||
**Bug Fixes**
|
**Bug Fixes**
|
||||||
|
|
||||||
* Improve error message when a plugin fails to load.
|
* Improve error message when a plugin fails to load.
|
||||||
Thanks :user:`nicoddemus` for the PR.
|
Thanks `@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
* Fix (:issue:`1178`):
|
* Fix (`#1178 <https://github.com/pytest-dev/pytest/issues/1178>`_):
|
||||||
``pytest.fail`` with non-ascii characters raises an internal pytest error.
|
``pytest.fail`` with non-ascii characters raises an internal pytest error.
|
||||||
Thanks :user:`nicoddemus` for the PR.
|
Thanks `@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
* Fix (:issue:`469`): junit parses report.nodeid incorrectly, when params IDs
|
* Fix (`#469`_): junit parses report.nodeid incorrectly, when params IDs
|
||||||
contain ``::``. Thanks :user:`tomviner` for the PR (:pull:`1431`).
|
contain ``::``. Thanks `@tomviner`_ for the PR (`#1431`_).
|
||||||
|
|
||||||
* Fix (:issue:`578`): SyntaxErrors
|
* Fix (`#578 <https://github.com/pytest-dev/pytest/issues/578>`_): SyntaxErrors
|
||||||
containing non-ascii lines at the point of failure generated an internal
|
containing non-ascii lines at the point of failure generated an internal
|
||||||
py.test error.
|
py.test error.
|
||||||
Thanks :user:`asottile` for the report and :user:`nicoddemus` for the PR.
|
Thanks `@asottile`_ for the report and `@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
* Fix (:issue:`1437`): When passing in a bytestring regex pattern to parameterize
|
* Fix (`#1437`_): When passing in a bytestring regex pattern to parameterize
|
||||||
attempt to decode it as utf-8 ignoring errors.
|
attempt to decode it as utf-8 ignoring errors.
|
||||||
|
|
||||||
* Fix (:issue:`649`): parametrized test nodes cannot be specified to run on the command line.
|
* Fix (`#649`_): parametrized test nodes cannot be specified to run on the command line.
|
||||||
|
|
||||||
|
|
||||||
|
.. _#1437: https://github.com/pytest-dev/pytest/issues/1437
|
||||||
|
.. _#469: https://github.com/pytest-dev/pytest/issues/469
|
||||||
|
.. _#1431: https://github.com/pytest-dev/pytest/pull/1431
|
||||||
|
.. _#649: https://github.com/pytest-dev/pytest/issues/649
|
||||||
|
|
||||||
|
.. _@asottile: https://github.com/asottile
|
||||||
|
.. _@nicoddemus: https://github.com/nicoddemus
|
||||||
|
.. _@tomviner: https://github.com/tomviner
|
||||||
|
|||||||
@@ -39,27 +39,40 @@ The py.test Development Team
|
|||||||
|
|
||||||
**Bug Fixes**
|
**Bug Fixes**
|
||||||
|
|
||||||
* fix :issue:`510`: skip tests where one parameterize dimension was empty
|
* fix `#510`_: skip tests where one parameterize dimension was empty
|
||||||
thanks Alex Stapleton for the Report and :user:`RonnyPfannschmidt` for the PR
|
thanks Alex Stapleton for the Report and `@RonnyPfannschmidt`_ for the PR
|
||||||
|
|
||||||
* Fix Xfail does not work with condition keyword argument.
|
* Fix Xfail does not work with condition keyword argument.
|
||||||
Thanks :user:`astraw38` for reporting the issue (:issue:`1496`) and :user:`tomviner`
|
Thanks `@astraw38`_ for reporting the issue (`#1496`_) and `@tomviner`_
|
||||||
for PR the (:pull:`1524`).
|
for PR the (`#1524`_).
|
||||||
|
|
||||||
* Fix win32 path issue when putting custom config file with absolute path
|
* Fix win32 path issue when putting custom config file with absolute path
|
||||||
in ``pytest.main("-c your_absolute_path")``.
|
in ``pytest.main("-c your_absolute_path")``.
|
||||||
|
|
||||||
* Fix maximum recursion depth detection when raised error class is not aware
|
* Fix maximum recursion depth detection when raised error class is not aware
|
||||||
of unicode/encoded bytes.
|
of unicode/encoded bytes.
|
||||||
Thanks :user:`prusse-martin` for the PR (:pull:`1506`).
|
Thanks `@prusse-martin`_ for the PR (`#1506`_).
|
||||||
|
|
||||||
* Fix ``pytest.mark.skip`` mark when used in strict mode.
|
* Fix ``pytest.mark.skip`` mark when used in strict mode.
|
||||||
Thanks :user:`pquentin` for the PR and :user:`RonnyPfannschmidt` for
|
Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for
|
||||||
showing how to fix the bug.
|
showing how to fix the bug.
|
||||||
|
|
||||||
* Minor improvements and fixes to the documentation.
|
* Minor improvements and fixes to the documentation.
|
||||||
Thanks :user:`omarkohl` for the PR.
|
Thanks `@omarkohl`_ for the PR.
|
||||||
|
|
||||||
* Fix ``--fixtures`` to show all fixture definitions as opposed to just
|
* Fix ``--fixtures`` to show all fixture definitions as opposed to just
|
||||||
one per fixture name.
|
one per fixture name.
|
||||||
Thanks to :user:`hackebrot` for the PR.
|
Thanks to `@hackebrot`_ for the PR.
|
||||||
|
|
||||||
|
.. _#510: https://github.com/pytest-dev/pytest/issues/510
|
||||||
|
.. _#1506: https://github.com/pytest-dev/pytest/pull/1506
|
||||||
|
.. _#1496: https://github.com/pytest-dev/pytest/issues/1496
|
||||||
|
.. _#1524: https://github.com/pytest-dev/pytest/pull/1524
|
||||||
|
|
||||||
|
.. _@astraw38: https://github.com/astraw38
|
||||||
|
.. _@hackebrot: https://github.com/hackebrot
|
||||||
|
.. _@omarkohl: https://github.com/omarkohl
|
||||||
|
.. _@pquentin: https://github.com/pquentin
|
||||||
|
.. _@prusse-martin: https://github.com/prusse-martin
|
||||||
|
.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
|
||||||
|
.. _@tomviner: https://github.com/tomviner
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
pytest-6.2.5
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
pytest 6.2.5 has just been released to PyPI.
|
|
||||||
|
|
||||||
This is a bug-fix release, being a drop-in replacement. To upgrade::
|
|
||||||
|
|
||||||
pip install --upgrade pytest
|
|
||||||
|
|
||||||
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Anthony Sottile
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Brylie Christopher Oxley
|
|
||||||
* Daniel Asztalos
|
|
||||||
* Florian Bruhin
|
|
||||||
* Jason Haugen
|
|
||||||
* MapleCCC
|
|
||||||
* Michał Górny
|
|
||||||
* Miro Hrončok
|
|
||||||
* Ran Benita
|
|
||||||
* Ronny Pfannschmidt
|
|
||||||
* Sylvain Bellemare
|
|
||||||
* Thomas Güttler
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
pytest-7.0.0
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
The pytest team is proud to announce the 7.0.0 release!
|
|
||||||
|
|
||||||
This release contains new features, improvements, bug fixes, and breaking changes, so users
|
|
||||||
are encouraged to take a look at the CHANGELOG carefully:
|
|
||||||
|
|
||||||
https://docs.pytest.org/en/stable/changelog.html
|
|
||||||
|
|
||||||
For complete documentation, please visit:
|
|
||||||
|
|
||||||
https://docs.pytest.org/en/stable/
|
|
||||||
|
|
||||||
As usual, you can upgrade from PyPI via:
|
|
||||||
|
|
||||||
pip install -U pytest
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Adam J. Stewart
|
|
||||||
* Alexander King
|
|
||||||
* Amin Alaee
|
|
||||||
* Andrew Neitsch
|
|
||||||
* Anthony Sottile
|
|
||||||
* Ben Davies
|
|
||||||
* Bernát Gábor
|
|
||||||
* Brian Okken
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Cristian Vera
|
|
||||||
* Dan Alvizu
|
|
||||||
* David Szotten
|
|
||||||
* Eddie
|
|
||||||
* Emmanuel Arias
|
|
||||||
* Emmanuel Meric de Bellefon
|
|
||||||
* Eric Liu
|
|
||||||
* Florian Bruhin
|
|
||||||
* GergelyKalmar
|
|
||||||
* Graeme Smecher
|
|
||||||
* Harshna
|
|
||||||
* Hugo van Kemenade
|
|
||||||
* Jakub Kulík
|
|
||||||
* James Myatt
|
|
||||||
* Jeff Rasley
|
|
||||||
* Kale Kundert
|
|
||||||
* Kian Meng, Ang
|
|
||||||
* Miro Hrončok
|
|
||||||
* Naveen-Pratap
|
|
||||||
* Oleg Höfling
|
|
||||||
* Olga Matoula
|
|
||||||
* Ran Benita
|
|
||||||
* Ronny Pfannschmidt
|
|
||||||
* Simon K
|
|
||||||
* Srip
|
|
||||||
* Sören Wegener
|
|
||||||
* Taneli Hukkinen
|
|
||||||
* Terje Runde
|
|
||||||
* Thomas Grainger
|
|
||||||
* Thomas Hisch
|
|
||||||
* William Jamir Silva
|
|
||||||
* Yuval Shimon
|
|
||||||
* Zac Hatfield-Dodds
|
|
||||||
* andrewdotn
|
|
||||||
* denivyruck
|
|
||||||
* ericluoliu
|
|
||||||
* oleg.hoefling
|
|
||||||
* symonk
|
|
||||||
* ziebam
|
|
||||||
* Éloi Rivard
|
|
||||||
* Éric
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
pytest-7.0.0rc1
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
The pytest team is proud to announce the 7.0.0rc1 prerelease!
|
|
||||||
|
|
||||||
This is a prerelease, not intended for production use, but to test the upcoming features and improvements
|
|
||||||
in order to catch any major problems before the final version is released to the major public.
|
|
||||||
|
|
||||||
We appreciate your help testing this out before the final release, making sure to report any
|
|
||||||
regressions to our issue tracker:
|
|
||||||
|
|
||||||
https://github.com/pytest-dev/pytest/issues
|
|
||||||
|
|
||||||
When doing so, please include the string ``[prerelease]`` in the title.
|
|
||||||
|
|
||||||
You can upgrade from PyPI via:
|
|
||||||
|
|
||||||
pip install pytest==7.0.0rc1
|
|
||||||
|
|
||||||
Users are encouraged to take a look at the CHANGELOG carefully:
|
|
||||||
|
|
||||||
https://docs.pytest.org/en/7.0.x/changelog.html
|
|
||||||
|
|
||||||
Thanks to all the contributors to this release:
|
|
||||||
|
|
||||||
* Adam J. Stewart
|
|
||||||
* Alexander King
|
|
||||||
* Amin Alaee
|
|
||||||
* Andrew Neitsch
|
|
||||||
* Anthony Sottile
|
|
||||||
* Ben Davies
|
|
||||||
* Bernát Gábor
|
|
||||||
* Brian Okken
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Cristian Vera
|
|
||||||
* David Szotten
|
|
||||||
* Eddie
|
|
||||||
* Emmanuel Arias
|
|
||||||
* Emmanuel Meric de Bellefon
|
|
||||||
* Eric Liu
|
|
||||||
* Florian Bruhin
|
|
||||||
* GergelyKalmar
|
|
||||||
* Graeme Smecher
|
|
||||||
* Harshna
|
|
||||||
* Hugo van Kemenade
|
|
||||||
* Jakub Kulík
|
|
||||||
* James Myatt
|
|
||||||
* Jeff Rasley
|
|
||||||
* Kale Kundert
|
|
||||||
* Miro Hrončok
|
|
||||||
* Naveen-Pratap
|
|
||||||
* Oleg Höfling
|
|
||||||
* Ran Benita
|
|
||||||
* Ronny Pfannschmidt
|
|
||||||
* Simon K
|
|
||||||
* Srip
|
|
||||||
* Sören Wegener
|
|
||||||
* Taneli Hukkinen
|
|
||||||
* Terje Runde
|
|
||||||
* Thomas Grainger
|
|
||||||
* Thomas Hisch
|
|
||||||
* William Jamir Silva
|
|
||||||
* Zac Hatfield-Dodds
|
|
||||||
* andrewdotn
|
|
||||||
* denivyruck
|
|
||||||
* ericluoliu
|
|
||||||
* oleg.hoefling
|
|
||||||
* symonk
|
|
||||||
* ziebam
|
|
||||||
* Éloi Rivard
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
pytest-7.0.1
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
pytest 7.0.1 has just been released to PyPI.
|
|
||||||
|
|
||||||
This is a bug-fix release, being a drop-in replacement. To upgrade::
|
|
||||||
|
|
||||||
pip install --upgrade pytest
|
|
||||||
|
|
||||||
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Anthony Sottile
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Ran Benita
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
pytest-7.1.0
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
The pytest team is proud to announce the 7.1.0 release!
|
|
||||||
|
|
||||||
This release contains new features, improvements, and bug fixes,
|
|
||||||
the full list of changes is available in the changelog:
|
|
||||||
|
|
||||||
https://docs.pytest.org/en/stable/changelog.html
|
|
||||||
|
|
||||||
For complete documentation, please visit:
|
|
||||||
|
|
||||||
https://docs.pytest.org/en/stable/
|
|
||||||
|
|
||||||
As usual, you can upgrade from PyPI via:
|
|
||||||
|
|
||||||
pip install -U pytest
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Akuli
|
|
||||||
* Andrew Svetlov
|
|
||||||
* Anthony Sottile
|
|
||||||
* Brett Holman
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Chris NeJame
|
|
||||||
* Dan Alvizu
|
|
||||||
* Elijah DeLee
|
|
||||||
* Emmanuel Arias
|
|
||||||
* Fabian Egli
|
|
||||||
* Florian Bruhin
|
|
||||||
* Gabor Szabo
|
|
||||||
* Hasan Ramezani
|
|
||||||
* Hugo van Kemenade
|
|
||||||
* Kian Meng, Ang
|
|
||||||
* Kojo Idrissa
|
|
||||||
* Masaru Tsuchiyama
|
|
||||||
* Olga Matoula
|
|
||||||
* P. L. Lim
|
|
||||||
* Ran Benita
|
|
||||||
* Tobias Deiminger
|
|
||||||
* Yuval Shimon
|
|
||||||
* eduardo naufel schettino
|
|
||||||
* Éric
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
pytest-7.1.1
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
pytest 7.1.1 has just been released to PyPI.
|
|
||||||
|
|
||||||
This is a bug-fix release, being a drop-in replacement. To upgrade::
|
|
||||||
|
|
||||||
pip install --upgrade pytest
|
|
||||||
|
|
||||||
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Ran Benita
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
pytest-7.1.2
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
pytest 7.1.2 has just been released to PyPI.
|
|
||||||
|
|
||||||
This is a bug-fix release, being a drop-in replacement. To upgrade::
|
|
||||||
|
|
||||||
pip install --upgrade pytest
|
|
||||||
|
|
||||||
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Anthony Sottile
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Hugo van Kemenade
|
|
||||||
* Kian Eliasi
|
|
||||||
* Ran Benita
|
|
||||||
* Zac Hatfield-Dodds
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
pytest-7.1.3
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
pytest 7.1.3 has just been released to PyPI.
|
|
||||||
|
|
||||||
This is a bug-fix release, being a drop-in replacement. To upgrade::
|
|
||||||
|
|
||||||
pip install --upgrade pytest
|
|
||||||
|
|
||||||
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Anthony Sottile
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Gergely Kalmár
|
|
||||||
* Nipunn Koorapati
|
|
||||||
* Pax
|
|
||||||
* Sviatoslav Sydorenko
|
|
||||||
* Tim Hoffmann
|
|
||||||
* Tony Narlock
|
|
||||||
* Wolfremium
|
|
||||||
* Zach OBrien
|
|
||||||
* aizpurua23a
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
pytest-7.2.0
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
The pytest team is proud to announce the 7.2.0 release!
|
|
||||||
|
|
||||||
This release contains new features, improvements, and bug fixes,
|
|
||||||
the full list of changes is available in the changelog:
|
|
||||||
|
|
||||||
https://docs.pytest.org/en/stable/changelog.html
|
|
||||||
|
|
||||||
For complete documentation, please visit:
|
|
||||||
|
|
||||||
https://docs.pytest.org/en/stable/
|
|
||||||
|
|
||||||
As usual, you can upgrade from PyPI via:
|
|
||||||
|
|
||||||
pip install -U pytest
|
|
||||||
|
|
||||||
Thanks to all of the contributors to this release:
|
|
||||||
|
|
||||||
* Aaron Berdy
|
|
||||||
* Adam Turner
|
|
||||||
* Albert Villanova del Moral
|
|
||||||
* Alice Purcell
|
|
||||||
* Anthony Sottile
|
|
||||||
* Anton Yakutovich
|
|
||||||
* Babak Keyvani
|
|
||||||
* Brandon Chinn
|
|
||||||
* Bruno Oliveira
|
|
||||||
* Chanvin Xiao
|
|
||||||
* Cheuk Ting Ho
|
|
||||||
* Chris Wheeler
|
|
||||||
* EmptyRabbit
|
|
||||||
* Ezio Melotti
|
|
||||||
* Florian Best
|
|
||||||
* Florian Bruhin
|
|
||||||
* Fredrik Berndtsson
|
|
||||||
* Gabriel Landau
|
|
||||||
* Gergely Kalmár
|
|
||||||
* Hugo van Kemenade
|
|
||||||
* James Gerity
|
|
||||||
* John Litborn
|
|
||||||
* Jon Parise
|
|
||||||
* Kevin C
|
|
||||||
* Kian Eliasi
|
|
||||||
* MatthewFlamm
|
|
||||||
* Miro Hrončok
|
|
||||||
* Nate Meyvis
|
|
||||||
* Neil Girdhar
|
|
||||||
* Nhieuvu1802
|
|
||||||
* Nipunn Koorapati
|
|
||||||
* Ofek Lev
|
|
||||||
* Paul Müller
|
|
||||||
* Paul Reece
|
|
||||||
* Pax
|
|
||||||
* Pete Baughman
|
|
||||||
* Peyman Salehi
|
|
||||||
* Philipp A
|
|
||||||
* Ran Benita
|
|
||||||
* Robert O'Shea
|
|
||||||
* Ronny Pfannschmidt
|
|
||||||
* Rowin
|
|
||||||
* Ruth Comer
|
|
||||||
* Samuel Colvin
|
|
||||||
* Samuel Gaist
|
|
||||||
* Sandro Tosi
|
|
||||||
* Shantanu
|
|
||||||
* Simon K
|
|
||||||
* Stephen Rosen
|
|
||||||
* Sviatoslav Sydorenko
|
|
||||||
* Tatiana Ovary
|
|
||||||
* Thierry Moisan
|
|
||||||
* Thomas Grainger
|
|
||||||
* Tim Hoffmann
|
|
||||||
* Tobias Diez
|
|
||||||
* Tony Narlock
|
|
||||||
* Vivaan Verma
|
|
||||||
* Wolfremium
|
|
||||||
* Zac Hatfield-Dodds
|
|
||||||
* Zach OBrien
|
|
||||||
* aizpurua23a
|
|
||||||
* gresm
|
|
||||||
* holesch
|
|
||||||
* itxasos23
|
|
||||||
* johnkangw
|
|
||||||
* skhomuti
|
|
||||||
* sommersoft
|
|
||||||
* wodny
|
|
||||||
* zx.qiu
|
|
||||||
|
|
||||||
|
|
||||||
Happy testing,
|
|
||||||
The pytest Development Team
|
|
||||||
@@ -22,9 +22,7 @@ b) transitional: the old and new API don't conflict
|
|||||||
|
|
||||||
We will only start the removal of deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will start to remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we start to remove it in 5.0, not in 4.0).
|
We will only start the removal of deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will start to remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we start to remove it in 5.0, not in 4.0).
|
||||||
|
|
||||||
A deprecated feature scheduled to be removed in major version X will use the warning class `PytestRemovedInXWarning` (a subclass of :class:`~pytest.PytestDeprecationwarning`).
|
When the deprecation expires (e.g. 4.0 is released), we won't remove the deprecated functionality immediately, but will use the standard warning filters to turn them into **errors** by default. This approach makes it explicit that removal is imminent, and still gives you time to turn the deprecated feature into a warning instead of an error so it can be dealt with in your own time. In the next minor release (e.g. 4.1), the feature will be effectively removed.
|
||||||
|
|
||||||
When the deprecation expires (e.g. 4.0 is released), we won't remove the deprecated functionality immediately, but will use the standard warning filters to turn `PytestRemovedInXWarning` (e.g. `PytestRemovedIn4Warning`) into **errors** by default. This approach makes it explicit that removal is imminent, and still gives you time to turn the deprecated feature into a warning instead of an error so it can be dealt with in your own time. In the next minor release (e.g. 4.1), the feature will be effectively removed.
|
|
||||||
|
|
||||||
|
|
||||||
c) true breakage: should only be considered when normal transition is unreasonably unsustainable and would offset important development/features by years.
|
c) true breakage: should only be considered when normal transition is unreasonably unsustainable and would offset important development/features by years.
|
||||||
@@ -32,15 +30,15 @@ c) true breakage: should only be considered when normal transition is unreasonab
|
|||||||
|
|
||||||
Examples for such upcoming changes:
|
Examples for such upcoming changes:
|
||||||
|
|
||||||
* removal of ``pytest_runtest_protocol/nextitem`` - :issue:`895`
|
* removal of ``pytest_runtest_protocol/nextitem`` - `#895`_
|
||||||
* rearranging of the node tree to include ``FunctionDefinition``
|
* rearranging of the node tree to include ``FunctionDefinition``
|
||||||
* rearranging of ``SetupState`` :issue:`895`
|
* rearranging of ``SetupState`` `#895`_
|
||||||
|
|
||||||
True breakages must be announced first in an issue containing:
|
True breakages must be announced first in an issue containing:
|
||||||
|
|
||||||
* Detailed description of the change
|
* Detailed description of the change
|
||||||
* Rationale
|
* Rationale
|
||||||
* Expected impact on users and plugin authors (example in :issue:`895`)
|
* Expected impact on users and plugin authors (example in `#895`_)
|
||||||
|
|
||||||
After there's no hard *-1* on the issue it should be followed up by an initial proof-of-concept Pull Request.
|
After there's no hard *-1* on the issue it should be followed up by an initial proof-of-concept Pull Request.
|
||||||
|
|
||||||
@@ -79,16 +77,4 @@ Features currently deprecated and removed in previous releases can be found in :
|
|||||||
We track future deprecation and removal of features using milestones and the `deprecation <https://github.com/pytest-dev/pytest/issues?q=label%3A%22type%3A+deprecation%22>`_ and `removal <https://github.com/pytest-dev/pytest/labels/type%3A%20removal>`_ labels on GitHub.
|
We track future deprecation and removal of features using milestones and the `deprecation <https://github.com/pytest-dev/pytest/issues?q=label%3A%22type%3A+deprecation%22>`_ and `removal <https://github.com/pytest-dev/pytest/labels/type%3A%20removal>`_ labels on GitHub.
|
||||||
|
|
||||||
|
|
||||||
Python version support
|
.. _`#895`: https://github.com/pytest-dev/pytest/issues/895
|
||||||
======================
|
|
||||||
|
|
||||||
Released pytest versions support all Python versions that are actively maintained at the time of the release:
|
|
||||||
|
|
||||||
============== ===================
|
|
||||||
pytest version min. Python version
|
|
||||||
============== ===================
|
|
||||||
7.1+ 3.7+
|
|
||||||
6.2 - 7.0 3.6+
|
|
||||||
5.0 - 6.1 3.5+
|
|
||||||
3.3 - 4.6 2.7, 3.4+
|
|
||||||
============== ===================
|
|
||||||
|
|||||||
@@ -16,13 +16,8 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||||||
|
|
||||||
.. code-block:: pytest
|
.. code-block:: pytest
|
||||||
|
|
||||||
$ pytest --fixtures -v
|
$ pytest -q --fixtures
|
||||||
=========================== test session starts ============================
|
cache
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
|
||||||
cachedir: .pytest_cache
|
|
||||||
rootdir: /home/sweet/project
|
|
||||||
collected 0 items
|
|
||||||
cache -- .../_pytest/cacheprovider.py:510
|
|
||||||
Return a cache object that can persist state between testing sessions.
|
Return a cache object that can persist state between testing sessions.
|
||||||
|
|
||||||
cache.get(key, default)
|
cache.get(key, default)
|
||||||
@@ -33,95 +28,40 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||||||
|
|
||||||
Values can be any object handled by the json stdlib module.
|
Values can be any object handled by the json stdlib module.
|
||||||
|
|
||||||
capsys -- .../_pytest/capture.py:905
|
capsys
|
||||||
Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
||||||
|
|
||||||
The captured output is made available via ``capsys.readouterr()`` method
|
The captured output is made available via ``capsys.readouterr()`` method
|
||||||
calls, which return a ``(out, err)`` namedtuple.
|
calls, which return a ``(out, err)`` namedtuple.
|
||||||
``out`` and ``err`` will be ``text`` objects.
|
``out`` and ``err`` will be ``text`` objects.
|
||||||
|
|
||||||
Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.
|
capsysbinary
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
def test_output(capsys):
|
|
||||||
print("hello")
|
|
||||||
captured = capsys.readouterr()
|
|
||||||
assert captured.out == "hello\n"
|
|
||||||
|
|
||||||
capsysbinary -- .../_pytest/capture.py:933
|
|
||||||
Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
||||||
|
|
||||||
The captured output is made available via ``capsysbinary.readouterr()``
|
The captured output is made available via ``capsysbinary.readouterr()``
|
||||||
method calls, which return a ``(out, err)`` namedtuple.
|
method calls, which return a ``(out, err)`` namedtuple.
|
||||||
``out`` and ``err`` will be ``bytes`` objects.
|
``out`` and ``err`` will be ``bytes`` objects.
|
||||||
|
|
||||||
Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.
|
capfd
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
def test_output(capsysbinary):
|
|
||||||
print("hello")
|
|
||||||
captured = capsysbinary.readouterr()
|
|
||||||
assert captured.out == b"hello\n"
|
|
||||||
|
|
||||||
capfd -- .../_pytest/capture.py:961
|
|
||||||
Enable text capturing of writes to file descriptors ``1`` and ``2``.
|
Enable text capturing of writes to file descriptors ``1`` and ``2``.
|
||||||
|
|
||||||
The captured output is made available via ``capfd.readouterr()`` method
|
The captured output is made available via ``capfd.readouterr()`` method
|
||||||
calls, which return a ``(out, err)`` namedtuple.
|
calls, which return a ``(out, err)`` namedtuple.
|
||||||
``out`` and ``err`` will be ``text`` objects.
|
``out`` and ``err`` will be ``text`` objects.
|
||||||
|
|
||||||
Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.
|
capfdbinary
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
def test_system_echo(capfd):
|
|
||||||
os.system('echo "hello"')
|
|
||||||
captured = capfd.readouterr()
|
|
||||||
assert captured.out == "hello\n"
|
|
||||||
|
|
||||||
capfdbinary -- .../_pytest/capture.py:989
|
|
||||||
Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
|
Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
|
||||||
|
|
||||||
The captured output is made available via ``capfd.readouterr()`` method
|
The captured output is made available via ``capfd.readouterr()`` method
|
||||||
calls, which return a ``(out, err)`` namedtuple.
|
calls, which return a ``(out, err)`` namedtuple.
|
||||||
``out`` and ``err`` will be ``byte`` objects.
|
``out`` and ``err`` will be ``byte`` objects.
|
||||||
|
|
||||||
Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.
|
doctest_namespace [session scope]
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
def test_system_echo(capfdbinary):
|
|
||||||
os.system('echo "hello"')
|
|
||||||
captured = capfdbinary.readouterr()
|
|
||||||
assert captured.out == b"hello\n"
|
|
||||||
|
|
||||||
doctest_namespace [session scope] -- .../_pytest/doctest.py:738
|
|
||||||
Fixture that returns a :py:class:`dict` that will be injected into the
|
Fixture that returns a :py:class:`dict` that will be injected into the
|
||||||
namespace of doctests.
|
namespace of doctests.
|
||||||
|
|
||||||
Usually this fixture is used in conjunction with another ``autouse`` fixture:
|
pytestconfig [session scope]
|
||||||
|
Session-scoped fixture that returns the :class:`pytest.Config` object.
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def add_np(doctest_namespace):
|
|
||||||
doctest_namespace["np"] = numpy
|
|
||||||
|
|
||||||
For more details: :ref:`doctest_namespace`.
|
|
||||||
|
|
||||||
pytestconfig [session scope] -- .../_pytest/fixtures.py:1351
|
|
||||||
Session-scoped fixture that returns the session's :class:`pytest.Config`
|
|
||||||
object.
|
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
@@ -129,7 +69,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||||||
if pytestconfig.getoption("verbose") > 0:
|
if pytestconfig.getoption("verbose") > 0:
|
||||||
...
|
...
|
||||||
|
|
||||||
record_property -- .../_pytest/junitxml.py:282
|
record_property
|
||||||
Add extra properties to the calling test.
|
Add extra properties to the calling test.
|
||||||
|
|
||||||
User properties become part of the test report and are available to the
|
User properties become part of the test report and are available to the
|
||||||
@@ -143,13 +83,13 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||||||
def test_function(record_property):
|
def test_function(record_property):
|
||||||
record_property("example_key", 1)
|
record_property("example_key", 1)
|
||||||
|
|
||||||
record_xml_attribute -- .../_pytest/junitxml.py:305
|
record_xml_attribute
|
||||||
Add extra xml attributes to the tag for the calling test.
|
Add extra xml attributes to the tag for the calling test.
|
||||||
|
|
||||||
The fixture is callable with ``name, value``. The value is
|
The fixture is callable with ``name, value``. The value is
|
||||||
automatically XML-encoded.
|
automatically XML-encoded.
|
||||||
|
|
||||||
record_testsuite_property [session scope] -- .../_pytest/junitxml.py:343
|
record_testsuite_property [session scope]
|
||||||
Record a new ``<property>`` tag as child of the root ``<testsuite>``.
|
Record a new ``<property>`` tag as child of the root ``<testsuite>``.
|
||||||
|
|
||||||
This is suitable to writing global information regarding the entire test
|
This is suitable to writing global information regarding the entire test
|
||||||
@@ -163,40 +103,15 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||||||
record_testsuite_property("ARCH", "PPC")
|
record_testsuite_property("ARCH", "PPC")
|
||||||
record_testsuite_property("STORAGE_TYPE", "CEPH")
|
record_testsuite_property("STORAGE_TYPE", "CEPH")
|
||||||
|
|
||||||
:param name:
|
``name`` must be a string, ``value`` will be converted to a string and properly xml-escaped.
|
||||||
The property name.
|
|
||||||
:param value:
|
|
||||||
The property value. Will be converted to a string.
|
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
Currently this fixture **does not work** with the
|
Currently this fixture **does not work** with the
|
||||||
`pytest-xdist <https://github.com/pytest-dev/pytest-xdist>`__ plugin. See
|
`pytest-xdist <https://github.com/pytest-dev/pytest-xdist>`__ plugin. See issue
|
||||||
:issue:`7767` for details.
|
`#7767 <https://github.com/pytest-dev/pytest/issues/7767>`__ for details.
|
||||||
|
|
||||||
tmpdir_factory [session scope] -- .../_pytest/legacypath.py:302
|
caplog
|
||||||
Return a :class:`pytest.TempdirFactory` instance for the test session.
|
|
||||||
|
|
||||||
tmpdir -- .../_pytest/legacypath.py:309
|
|
||||||
Return a temporary directory path object which is unique to each test
|
|
||||||
function invocation, created as a sub directory of the base temporary
|
|
||||||
directory.
|
|
||||||
|
|
||||||
By default, a new base temporary directory is created each test session,
|
|
||||||
and old bases are removed after 3 sessions, to aid in debugging. If
|
|
||||||
``--basetemp`` is used then it is cleared each session. See :ref:`base
|
|
||||||
temporary directory`.
|
|
||||||
|
|
||||||
The returned object is a `legacy_path`_ object.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
These days, it is preferred to use ``tmp_path``.
|
|
||||||
|
|
||||||
:ref:`About the tmpdir and tmpdir_factory fixtures<tmpdir and tmpdir_factory>`.
|
|
||||||
|
|
||||||
.. _legacy_path: https://py.readthedocs.io/en/latest/path.html
|
|
||||||
|
|
||||||
caplog -- .../_pytest/logging.py:491
|
|
||||||
Access and control log capturing.
|
Access and control log capturing.
|
||||||
|
|
||||||
Captured logs are available through the following properties/methods::
|
Captured logs are available through the following properties/methods::
|
||||||
@@ -207,40 +122,52 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||||||
* caplog.record_tuples -> list of (logger_name, level, message) tuples
|
* caplog.record_tuples -> list of (logger_name, level, message) tuples
|
||||||
* caplog.clear() -> clear captured records and formatted log output string
|
* caplog.clear() -> clear captured records and formatted log output string
|
||||||
|
|
||||||
monkeypatch -- .../_pytest/monkeypatch.py:29
|
monkeypatch
|
||||||
A convenient fixture for monkey-patching.
|
A convenient fixture for monkey-patching.
|
||||||
|
|
||||||
The fixture provides these methods to modify objects, dictionaries, or
|
The fixture provides these methods to modify objects, dictionaries or
|
||||||
:data:`os.environ`:
|
os.environ::
|
||||||
|
|
||||||
* :meth:`monkeypatch.setattr(obj, name, value, raising=True) <pytest.MonkeyPatch.setattr>`
|
monkeypatch.setattr(obj, name, value, raising=True)
|
||||||
* :meth:`monkeypatch.delattr(obj, name, raising=True) <pytest.MonkeyPatch.delattr>`
|
monkeypatch.delattr(obj, name, raising=True)
|
||||||
* :meth:`monkeypatch.setitem(mapping, name, value) <pytest.MonkeyPatch.setitem>`
|
monkeypatch.setitem(mapping, name, value)
|
||||||
* :meth:`monkeypatch.delitem(obj, name, raising=True) <pytest.MonkeyPatch.delitem>`
|
monkeypatch.delitem(obj, name, raising=True)
|
||||||
* :meth:`monkeypatch.setenv(name, value, prepend=None) <pytest.MonkeyPatch.setenv>`
|
monkeypatch.setenv(name, value, prepend=False)
|
||||||
* :meth:`monkeypatch.delenv(name, raising=True) <pytest.MonkeyPatch.delenv>`
|
monkeypatch.delenv(name, raising=True)
|
||||||
* :meth:`monkeypatch.syspath_prepend(path) <pytest.MonkeyPatch.syspath_prepend>`
|
monkeypatch.syspath_prepend(path)
|
||||||
* :meth:`monkeypatch.chdir(path) <pytest.MonkeyPatch.chdir>`
|
monkeypatch.chdir(path)
|
||||||
* :meth:`monkeypatch.context() <pytest.MonkeyPatch.context>`
|
|
||||||
|
|
||||||
All modifications will be undone after the requesting test function or
|
All modifications will be undone after the requesting test function or
|
||||||
fixture has finished. The ``raising`` parameter determines if a :class:`KeyError`
|
fixture has finished. The ``raising`` parameter determines if a KeyError
|
||||||
or :class:`AttributeError` will be raised if the set/deletion operation does not have the
|
or AttributeError will be raised if the set/deletion operation has no target.
|
||||||
specified target.
|
|
||||||
|
|
||||||
To undo modifications done by the fixture in a contained scope,
|
recwarn
|
||||||
use :meth:`context() <pytest.MonkeyPatch.context>`.
|
|
||||||
|
|
||||||
recwarn -- .../_pytest/recwarn.py:30
|
|
||||||
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
|
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
|
||||||
|
|
||||||
See https://docs.pytest.org/en/latest/how-to/capture-warnings.html for information
|
See https://docs.python.org/library/warnings.html for information
|
||||||
on warning categories.
|
on warning categories.
|
||||||
|
|
||||||
tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:188
|
tmpdir_factory [session scope]
|
||||||
|
Return a :class:`pytest.TempdirFactory` instance for the test session.
|
||||||
|
|
||||||
|
tmp_path_factory [session scope]
|
||||||
Return a :class:`pytest.TempPathFactory` instance for the test session.
|
Return a :class:`pytest.TempPathFactory` instance for the test session.
|
||||||
|
|
||||||
tmp_path -- .../_pytest/tmpdir.py:203
|
tmpdir
|
||||||
|
Return a temporary directory path object which is unique to each test
|
||||||
|
function invocation, created as a sub directory of the base temporary
|
||||||
|
directory.
|
||||||
|
|
||||||
|
By default, a new base temporary directory is created each test session,
|
||||||
|
and old bases are removed after 3 sessions, to aid in debugging. If
|
||||||
|
``--basetemp`` is used then it is cleared each session. See :ref:`base
|
||||||
|
temporary directory`.
|
||||||
|
|
||||||
|
The returned object is a `py.path.local`_ path object.
|
||||||
|
|
||||||
|
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
|
||||||
|
|
||||||
|
tmp_path
|
||||||
Return a temporary directory path object which is unique to each test
|
Return a temporary directory path object which is unique to each test
|
||||||
function invocation, created as a sub directory of the base temporary
|
function invocation, created as a sub directory of the base temporary
|
||||||
directory.
|
directory.
|
||||||
@@ -253,7 +180,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||||||
The returned object is a :class:`pathlib.Path` object.
|
The returned object is a :class:`pathlib.Path` object.
|
||||||
|
|
||||||
|
|
||||||
========================== no tests ran in 0.12s ===========================
|
no tests ran in 0.12s
|
||||||
|
|
||||||
You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like:
|
You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like:
|
||||||
|
|
||||||
|
|||||||
4074
doc/en/changelog.rst
@@ -17,9 +17,7 @@
|
|||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
import ast
|
import ast
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import sys
|
import sys
|
||||||
from textwrap import dedent
|
|
||||||
from typing import List
|
from typing import List
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
@@ -38,26 +36,8 @@ release = ".".join(version.split(".")[:2])
|
|||||||
|
|
||||||
autodoc_member_order = "bysource"
|
autodoc_member_order = "bysource"
|
||||||
autodoc_typehints = "description"
|
autodoc_typehints = "description"
|
||||||
autodoc_typehints_description_target = "documented"
|
|
||||||
todo_include_todos = 1
|
todo_include_todos = 1
|
||||||
|
|
||||||
latex_engine = "lualatex"
|
|
||||||
|
|
||||||
latex_elements = {
|
|
||||||
"preamble": dedent(
|
|
||||||
r"""
|
|
||||||
\directlua{
|
|
||||||
luaotfload.add_fallback("fallbacks", {
|
|
||||||
"Noto Serif CJK SC:style=Regular;",
|
|
||||||
"Symbola:Style=Regular;"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
\setmainfont{FreeSerif}[RawFeature={fallback=fallbacks}]
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# -- General configuration -----------------------------------------------------
|
# -- General configuration -----------------------------------------------------
|
||||||
|
|
||||||
# If your documentation needs a minimal Sphinx version, state it here.
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
@@ -70,7 +50,6 @@ extensions = [
|
|||||||
"pygments_pytest",
|
"pygments_pytest",
|
||||||
"sphinx.ext.autodoc",
|
"sphinx.ext.autodoc",
|
||||||
"sphinx.ext.autosummary",
|
"sphinx.ext.autosummary",
|
||||||
"sphinx.ext.extlinks",
|
|
||||||
"sphinx.ext.intersphinx",
|
"sphinx.ext.intersphinx",
|
||||||
"sphinx.ext.todo",
|
"sphinx.ext.todo",
|
||||||
"sphinx.ext.viewcode",
|
"sphinx.ext.viewcode",
|
||||||
@@ -78,13 +57,6 @@ extensions = [
|
|||||||
"sphinxcontrib_trio",
|
"sphinxcontrib_trio",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Building PDF docs on readthedocs requires inkscape for svg to pdf
|
|
||||||
# conversion. The relevant plugin is not useful for normal HTML builds, but
|
|
||||||
# it still raises warnings and fails CI if inkscape is not available. So
|
|
||||||
# only use the plugin if inkscape is actually available.
|
|
||||||
if shutil.which("inkscape"):
|
|
||||||
extensions.append("sphinxcontrib.inkscapeconverter")
|
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ["_templates"]
|
templates_path = ["_templates"]
|
||||||
|
|
||||||
@@ -99,7 +71,7 @@ master_doc = "contents"
|
|||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = "pytest"
|
project = "pytest"
|
||||||
copyright = "2015, holger krekel and pytest-dev team"
|
copyright = "2015–2021, holger krekel and pytest-dev team"
|
||||||
|
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
@@ -151,6 +123,7 @@ pygments_style = "sphinx"
|
|||||||
# A list of regular expressions that match URIs that should not be checked when
|
# A list of regular expressions that match URIs that should not be checked when
|
||||||
# doing a linkcheck.
|
# doing a linkcheck.
|
||||||
linkcheck_ignore = [
|
linkcheck_ignore = [
|
||||||
|
"https://github.com/numpy/numpy/blob/master/doc/release/1.16.0-notes.rst#new-deprecations",
|
||||||
"https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/",
|
"https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/",
|
||||||
"http://pythontesting.net/framework/pytest-introduction/",
|
"http://pythontesting.net/framework/pytest-introduction/",
|
||||||
r"https://github.com/pytest-dev/pytest/issues/\d+",
|
r"https://github.com/pytest-dev/pytest/issues/\d+",
|
||||||
@@ -161,16 +134,6 @@ linkcheck_ignore = [
|
|||||||
linkcheck_workers = 5
|
linkcheck_workers = 5
|
||||||
|
|
||||||
|
|
||||||
_repo = "https://github.com/pytest-dev/pytest"
|
|
||||||
extlinks = {
|
|
||||||
"bpo": ("https://bugs.python.org/issue%s", "bpo-%s"),
|
|
||||||
"pypi": ("https://pypi.org/project/%s/", "%s"),
|
|
||||||
"issue": (f"{_repo}/issues/%s", "issue #%s"),
|
|
||||||
"pull": (f"{_repo}/pull/%s", "pull request #%s"),
|
|
||||||
"user": ("https://github.com/%s", "@%s"),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output ---------------------------------------------------
|
# -- Options for HTML output ---------------------------------------------------
|
||||||
|
|
||||||
sys.path.append(os.path.abspath("_themes"))
|
sys.path.append(os.path.abspath("_themes"))
|
||||||
@@ -248,7 +211,7 @@ html_sidebars = {
|
|||||||
html_domain_indices = True
|
html_domain_indices = True
|
||||||
|
|
||||||
# If false, no index is generated.
|
# If false, no index is generated.
|
||||||
html_use_index = False
|
html_use_index = True
|
||||||
|
|
||||||
# If true, the index is split into individual pages for each letter.
|
# If true, the index is split into individual pages for each letter.
|
||||||
# html_split_index = False
|
# html_split_index = False
|
||||||
@@ -321,9 +284,7 @@ latex_domain_indices = False
|
|||||||
|
|
||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [
|
man_pages = [("usage", "pytest", "pytest usage", ["holger krekel at merlinux eu"], 1)]
|
||||||
("how-to/usage", "pytest", "pytest usage", ["holger krekel at merlinux eu"], 1)
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for Epub output ---------------------------------------------------
|
# -- Options for Epub output ---------------------------------------------------
|
||||||
@@ -332,7 +293,7 @@ man_pages = [
|
|||||||
epub_title = "pytest"
|
epub_title = "pytest"
|
||||||
epub_author = "holger krekel at merlinux eu"
|
epub_author = "holger krekel at merlinux eu"
|
||||||
epub_publisher = "holger krekel at merlinux eu"
|
epub_publisher = "holger krekel at merlinux eu"
|
||||||
epub_copyright = "2013, holger krekel et alii"
|
epub_copyright = "2013-2021, holger krekel et alii"
|
||||||
|
|
||||||
# The language of the text. It defaults to the language option
|
# The language of the text. It defaults to the language option
|
||||||
# or en if the language is not set.
|
# or en if the language is not set.
|
||||||
@@ -385,15 +346,10 @@ texinfo_documents = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
intersphinx_mapping = {
|
intersphinx_mapping = {
|
||||||
"pluggy": ("https://pluggy.readthedocs.io/en/stable", None),
|
"pluggy": ("https://pluggy.readthedocs.io/en/latest", None),
|
||||||
"python": ("https://docs.python.org/3", None),
|
"python": ("https://docs.python.org/3", None),
|
||||||
"numpy": ("https://numpy.org/doc/stable", None),
|
|
||||||
"pip": ("https://pip.pypa.io/en/stable", None),
|
|
||||||
"tox": ("https://tox.wiki/en/stable", None),
|
|
||||||
"virtualenv": ("https://virtualenv.pypa.io/en/stable", None),
|
|
||||||
"setuptools": ("https://setuptools.pypa.io/en/stable", None),
|
|
||||||
"packaging": ("https://packaging.python.org/en/latest", None),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -421,6 +377,8 @@ def configure_logging(app: "sphinx.application.Sphinx") -> None:
|
|||||||
|
|
||||||
|
|
||||||
def setup(app: "sphinx.application.Sphinx") -> None:
|
def setup(app: "sphinx.application.Sphinx") -> None:
|
||||||
|
# from sphinx.ext.autodoc import cut_lines
|
||||||
|
# app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
|
||||||
app.add_crossref_type(
|
app.add_crossref_type(
|
||||||
"fixture",
|
"fixture",
|
||||||
"fixture",
|
"fixture",
|
||||||
@@ -442,13 +400,6 @@ def setup(app: "sphinx.application.Sphinx") -> None:
|
|||||||
indextemplate="pair: %s; global variable interpreted by pytest",
|
indextemplate="pair: %s; global variable interpreted by pytest",
|
||||||
)
|
)
|
||||||
|
|
||||||
app.add_crossref_type(
|
|
||||||
directivename="hook",
|
|
||||||
rolename="hook",
|
|
||||||
objname="pytest hook",
|
|
||||||
indextemplate="pair: %s; hook",
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_logging(app)
|
configure_logging(app)
|
||||||
|
|
||||||
# Make Sphinx mark classes with "final" when decorated with @final.
|
# Make Sphinx mark classes with "final" when decorated with @final.
|
||||||
@@ -469,7 +420,3 @@ def setup(app: "sphinx.application.Sphinx") -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
sphinx.pycode.parser.VariableCommentPicker.is_final = patched_is_final
|
sphinx.pycode.parser.VariableCommentPicker.is_final = patched_is_final
|
||||||
|
|
||||||
# legacypath.py monkey-patches pytest.Testdir in. Import the file so
|
|
||||||
# that autodoc can discover references to it.
|
|
||||||
import _pytest.legacypath # noqa: F401
|
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ Contact channels
|
|||||||
|
|
||||||
- `pytest issue tracker`_ to report bugs or suggest features (for version
|
- `pytest issue tracker`_ to report bugs or suggest features (for version
|
||||||
2.0 and above).
|
2.0 and above).
|
||||||
- `pytest discussions`_ at github for general questions.
|
|
||||||
- `pytest discord server <https://discord.com/invite/pytest-dev>`_
|
|
||||||
for pytest development visibility and general assistance.
|
|
||||||
- `pytest on stackoverflow.com <http://stackoverflow.com/search?q=pytest>`_
|
- `pytest on stackoverflow.com <http://stackoverflow.com/search?q=pytest>`_
|
||||||
to post precise questions with the tag ``pytest``. New Questions will usually
|
to post questions with the tag ``pytest``. New Questions will usually
|
||||||
be seen by pytest users or developers and answered quickly.
|
be seen by pytest users or developers and answered quickly.
|
||||||
|
|
||||||
- `Testing In Python`_: a mailing list for Python testing tools and discussion.
|
- `Testing In Python`_: a mailing list for Python testing tools and discussion.
|
||||||
@@ -35,8 +33,6 @@ Contact channels
|
|||||||
.. _`pytest issue tracker`: https://github.com/pytest-dev/pytest/issues
|
.. _`pytest issue tracker`: https://github.com/pytest-dev/pytest/issues
|
||||||
.. _`old issue tracker`: https://bitbucket.org/hpk42/py-trunk/issues/
|
.. _`old issue tracker`: https://bitbucket.org/hpk42/py-trunk/issues/
|
||||||
|
|
||||||
.. _`pytest discussions`: https://github.com/pytest-dev/pytest/discussions
|
|
||||||
|
|
||||||
.. _`merlinux.eu`: https://merlinux.eu/
|
.. _`merlinux.eu`: https://merlinux.eu/
|
||||||
|
|
||||||
.. _`get an account`:
|
.. _`get an account`:
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ How-to guides
|
|||||||
how-to/fixtures
|
how-to/fixtures
|
||||||
how-to/mark
|
how-to/mark
|
||||||
how-to/parametrize
|
how-to/parametrize
|
||||||
how-to/tmp_path
|
how-to/tmpdir
|
||||||
how-to/monkeypatch
|
how-to/monkeypatch
|
||||||
how-to/doctest
|
how-to/doctest
|
||||||
how-to/cache
|
how-to/cache
|
||||||
@@ -85,6 +85,7 @@ Further topics
|
|||||||
|
|
||||||
backwards-compatibility
|
backwards-compatibility
|
||||||
deprecations
|
deprecations
|
||||||
|
py27-py34-deprecation
|
||||||
|
|
||||||
contributing
|
contributing
|
||||||
development_guide
|
development_guide
|
||||||
@@ -94,9 +95,9 @@ Further topics
|
|||||||
license
|
license
|
||||||
contact
|
contact
|
||||||
|
|
||||||
history
|
|
||||||
historical-notes
|
historical-notes
|
||||||
talks
|
talks
|
||||||
|
projects
|
||||||
|
|
||||||
|
|
||||||
.. only:: html
|
.. only:: html
|
||||||
|
|||||||
@@ -16,369 +16,32 @@ Deprecated Features
|
|||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Below is a complete list of all pytest features which are considered deprecated. Using those features will issue
|
Below is a complete list of all pytest features which are considered deprecated. Using those features will issue
|
||||||
:class:`~pytest.PytestWarning` or subclasses, which can be filtered using :ref:`standard warning filters <warnings>`.
|
:class:`PytestWarning` or subclasses, which can be filtered using :ref:`standard warning filters <warnings>`.
|
||||||
|
|
||||||
|
|
||||||
.. _nose-deprecation:
|
|
||||||
|
|
||||||
Support for tests written for nose
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.2
|
|
||||||
|
|
||||||
Support for running tests written for `nose <https://nose.readthedocs.io/en/latest/>`__ is now deprecated.
|
|
||||||
|
|
||||||
``nose`` has been in maintenance mode-only for years, and maintaining the plugin is not trivial as it spills
|
|
||||||
over the code base (see :issue:`9886` for more details).
|
|
||||||
|
|
||||||
setup/teardown
|
|
||||||
^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
One thing that might catch users by surprise is that plain ``setup`` and ``teardown`` methods are not pytest native,
|
|
||||||
they are in fact part of the ``nose`` support.
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
class Test:
|
|
||||||
def setup(self):
|
|
||||||
self.resource = make_resource()
|
|
||||||
|
|
||||||
def teardown(self):
|
|
||||||
self.resource.close()
|
|
||||||
|
|
||||||
def test_foo(self):
|
|
||||||
...
|
|
||||||
|
|
||||||
def test_bar(self):
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Native pytest support uses ``setup_method`` and ``teardown_method`` (see :ref:`xunit-method-setup`), so the above should be changed to:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
class Test:
|
|
||||||
def setup_method(self):
|
|
||||||
self.resource = make_resource()
|
|
||||||
|
|
||||||
def teardown_method(self):
|
|
||||||
self.resource.close()
|
|
||||||
|
|
||||||
def test_foo(self):
|
|
||||||
...
|
|
||||||
|
|
||||||
def test_bar(self):
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
This is easy to do in an entire code base by doing a simple find/replace.
|
|
||||||
|
|
||||||
@with_setup
|
|
||||||
^^^^^^^^^^^
|
|
||||||
|
|
||||||
Code using `@with_setup <with-setup-nose>`_ such as this:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from nose.tools import with_setup
|
|
||||||
|
|
||||||
|
|
||||||
def setup_some_resource():
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
def teardown_some_resource():
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
@with_setup(setup_some_resource, teardown_some_resource)
|
|
||||||
def test_foo():
|
|
||||||
...
|
|
||||||
|
|
||||||
Will also need to be ported to a supported pytest style. One way to do it is using a fixture:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
def setup_some_resource():
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
def teardown_some_resource():
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def some_resource():
|
|
||||||
setup_some_resource()
|
|
||||||
yield
|
|
||||||
teardown_some_resource()
|
|
||||||
|
|
||||||
|
|
||||||
def test_foo(some_resource):
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
.. _`with-setup-nose`: https://nose.readthedocs.io/en/latest/testing_tools.html?highlight=with_setup#nose.tools.with_setup
|
|
||||||
|
|
||||||
.. _instance-collector-deprecation:
|
|
||||||
|
|
||||||
The ``pytest.Instance`` collector
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. versionremoved:: 7.0
|
|
||||||
|
|
||||||
The ``pytest.Instance`` collector type has been removed.
|
|
||||||
|
|
||||||
Previously, Python test methods were collected as :class:`~pytest.Class` -> ``Instance`` -> :class:`~pytest.Function`.
|
|
||||||
Now :class:`~pytest.Class` collects the test methods directly.
|
|
||||||
|
|
||||||
Most plugins which reference ``Instance`` do so in order to ignore or skip it,
|
|
||||||
using a check such as ``if isinstance(node, Instance): return``.
|
|
||||||
Such plugins should simply remove consideration of ``Instance`` on pytest>=7.
|
|
||||||
However, to keep such uses working, a dummy type has been instanted in ``pytest.Instance`` and ``_pytest.python.Instance``,
|
|
||||||
and importing it emits a deprecation warning. This will be removed in pytest 8.
|
|
||||||
|
|
||||||
|
|
||||||
.. _node-ctor-fspath-deprecation:
|
|
||||||
|
|
||||||
``fspath`` argument for Node constructors replaced with ``pathlib.Path``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
|
||||||
|
|
||||||
In order to support the transition from ``py.path.local`` to :mod:`pathlib`,
|
|
||||||
the ``fspath`` argument to :class:`~_pytest.nodes.Node` constructors like
|
|
||||||
:func:`pytest.Function.from_parent()` and :func:`pytest.Class.from_parent()`
|
|
||||||
is now deprecated.
|
|
||||||
|
|
||||||
Plugins which construct nodes should pass the ``path`` argument, of type
|
|
||||||
:class:`pathlib.Path`, instead of the ``fspath`` argument.
|
|
||||||
|
|
||||||
Plugins which implement custom items and collectors are encouraged to replace
|
|
||||||
``fspath`` parameters (``py.path.local``) with ``path`` parameters
|
|
||||||
(``pathlib.Path``), and drop any other usage of the ``py`` library if possible.
|
|
||||||
|
|
||||||
If possible, plugins with custom items should use :ref:`cooperative
|
|
||||||
constructors <uncooperative-constructors-deprecated>` to avoid hardcoding
|
|
||||||
arguments they only pass on to the superclass.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the
|
|
||||||
new attribute being ``path``) is **the opposite** of the situation for
|
|
||||||
hooks, :ref:`outlined below <legacy-path-hooks-deprecated>` (the old
|
|
||||||
argument being ``path``).
|
|
||||||
|
|
||||||
This is an unfortunate artifact due to historical reasons, which should be
|
|
||||||
resolved in future versions as we slowly get rid of the :pypi:`py`
|
|
||||||
dependency (see :issue:`9283` for a longer discussion).
|
|
||||||
|
|
||||||
Due to the ongoing migration of methods like :meth:`~_pytest.Item.reportinfo`
|
|
||||||
which still is expected to return a ``py.path.local`` object, nodes still have
|
|
||||||
both ``fspath`` (``py.path.local``) and ``path`` (``pathlib.Path``) attributes,
|
|
||||||
no matter what argument was used in the constructor. We expect to deprecate the
|
|
||||||
``fspath`` attribute in a future release.
|
|
||||||
|
|
||||||
.. _legacy-path-hooks-deprecated:
|
|
||||||
|
|
||||||
Configuring hook specs/impls using markers
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Before pluggy, pytest's plugin library, was its own package and had a clear API,
|
|
||||||
pytest just used ``pytest.mark`` to configure hooks.
|
|
||||||
|
|
||||||
The :py:func:`pytest.hookimpl` and :py:func:`pytest.hookspec` decorators
|
|
||||||
have been available since years and should be used instead.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
@pytest.mark.tryfirst
|
|
||||||
def pytest_runtest_call():
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
# or
|
|
||||||
def pytest_runtest_call():
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
pytest_runtest_call.tryfirst = True
|
|
||||||
|
|
||||||
should be changed to:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
@pytest.hookimpl(tryfirst=True)
|
|
||||||
def pytest_runtest_call():
|
|
||||||
...
|
|
||||||
|
|
||||||
Changed ``hookimpl`` attributes:
|
|
||||||
|
|
||||||
* ``tryfirst``
|
|
||||||
* ``trylast``
|
|
||||||
* ``optionalhook``
|
|
||||||
* ``hookwrapper``
|
|
||||||
|
|
||||||
Changed ``hookwrapper`` attributes:
|
|
||||||
|
|
||||||
* ``firstresult``
|
|
||||||
* ``historic``
|
|
||||||
|
|
||||||
|
|
||||||
``py.path.local`` arguments for hooks replaced with ``pathlib.Path``
|
``py.path.local`` arguments for hooks replaced with ``pathlib.Path``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
In order to support the transition to :mod:`pathlib`, the following hooks now receive additional arguments:
|
||||||
|
|
||||||
In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the following hooks now receive additional arguments:
|
* :func:`pytest_ignore_collect(fspath: pathlib.Path) <_pytest.hookspec.pytest_ignore_collect>`
|
||||||
|
* :func:`pytest_collect_file(fspath: pathlib.Path) <_pytest.hookspec.pytest_collect_file>`
|
||||||
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
|
* :func:`pytest_pycollect_makemodule(fspath: pathlib.Path) <_pytest.hookspec.pytest_pycollect_makemodule>`
|
||||||
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
|
* :func:`pytest_report_header(startpath: pathlib.Path) <_pytest.hookspec.pytest_report_header>`
|
||||||
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
|
* :func:`pytest_report_collectionfinish(startpath: pathlib.Path) <_pytest.hookspec.pytest_report_collectionfinish>`
|
||||||
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
|
|
||||||
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
|
|
||||||
|
|
||||||
The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments.
|
The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments.
|
||||||
|
|
||||||
.. note::
|
|
||||||
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
|
|
||||||
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
|
|
||||||
being ``path``) is **the opposite** of the situation for hooks (the old
|
|
||||||
argument being ``path``).
|
|
||||||
|
|
||||||
This is an unfortunate artifact due to historical reasons, which should be
|
``Node.fspath`` in favor of ``pathlib`` and ``Node.path``
|
||||||
resolved in future versions as we slowly get rid of the :pypi:`py`
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
dependency (see :issue:`9283` for a longer discussion).
|
|
||||||
|
|
||||||
Directly constructing internal classes
|
.. deprecated:: 6.3
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
As pytest tries to move off `py.path.local <https://py.readthedocs.io/en/latest/path.html>`__ we ported most of the node internals to :mod:`pathlib`.
|
||||||
|
|
||||||
Directly constructing the following classes is now deprecated:
|
Pytest will provide compatibility for quite a while.
|
||||||
|
|
||||||
- ``_pytest.mark.structures.Mark``
|
|
||||||
- ``_pytest.mark.structures.MarkDecorator``
|
|
||||||
- ``_pytest.mark.structures.MarkGenerator``
|
|
||||||
- ``_pytest.python.Metafunc``
|
|
||||||
- ``_pytest.runner.CallInfo``
|
|
||||||
- ``_pytest._code.ExceptionInfo``
|
|
||||||
- ``_pytest.config.argparsing.Parser``
|
|
||||||
- ``_pytest.config.argparsing.OptionGroup``
|
|
||||||
- ``_pytest.pytester.HookRecorder``
|
|
||||||
|
|
||||||
These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8.
|
|
||||||
|
|
||||||
.. _cmdline-preparse-deprecated:
|
|
||||||
|
|
||||||
Passing ``msg=`` to ``pytest.skip``, ``pytest.fail`` or ``pytest.exit``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
|
||||||
|
|
||||||
Passing the keyword argument ``msg`` to :func:`pytest.skip`, :func:`pytest.fail` or :func:`pytest.exit`
|
|
||||||
is now deprecated and ``reason`` should be used instead. This change is to bring consistency between these
|
|
||||||
functions and the ``@pytest.mark.skip`` and ``@pytest.mark.xfail`` markers which already accept a ``reason`` argument.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
def test_fail_example():
|
|
||||||
# old
|
|
||||||
pytest.fail(msg="foo")
|
|
||||||
# new
|
|
||||||
pytest.fail(reason="bar")
|
|
||||||
|
|
||||||
|
|
||||||
def test_skip_example():
|
|
||||||
# old
|
|
||||||
pytest.skip(msg="foo")
|
|
||||||
# new
|
|
||||||
pytest.skip(reason="bar")
|
|
||||||
|
|
||||||
|
|
||||||
def test_exit_example():
|
|
||||||
# old
|
|
||||||
pytest.exit(msg="foo")
|
|
||||||
# new
|
|
||||||
pytest.exit(reason="bar")
|
|
||||||
|
|
||||||
|
|
||||||
Implementing the ``pytest_cmdline_preparse`` hook
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
|
||||||
|
|
||||||
Implementing the :hook:`pytest_cmdline_preparse` hook has been officially deprecated.
|
|
||||||
Implement the :hook:`pytest_load_initial_conftests` hook instead.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
def pytest_cmdline_preparse(config: Config, args: List[str]) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
# becomes:
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_load_initial_conftests(
|
|
||||||
early_config: Config, parser: Parser, args: List[str]
|
|
||||||
) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
.. _diamond-inheritance-deprecated:
|
|
||||||
|
|
||||||
Diamond inheritance between :class:`pytest.Collector` and :class:`pytest.Item`
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
|
||||||
|
|
||||||
Defining a custom pytest node type which is both an :class:`pytest.Item <Item>` and a :class:`pytest.Collector <Collector>` (e.g. :class:`pytest.File <File>`) now issues a warning.
|
|
||||||
It was never sanely supported and triggers hard to debug errors.
|
|
||||||
|
|
||||||
Some plugins providing linting/code analysis have been using this as a hack.
|
|
||||||
Instead, a separate collector node should be used, which collects the item. See
|
|
||||||
:ref:`non-python tests` for an example, as well as an `example pr fixing inheritance`_.
|
|
||||||
|
|
||||||
.. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files
|
|
||||||
|
|
||||||
|
|
||||||
.. _uncooperative-constructors-deprecated:
|
|
||||||
|
|
||||||
Constructors of custom :class:`pytest.Node` subclasses should take ``**kwargs``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
|
||||||
|
|
||||||
If custom subclasses of nodes like :class:`pytest.Item` override the
|
|
||||||
``__init__`` method, they should take ``**kwargs``. Thus,
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
class CustomItem(pytest.Item):
|
|
||||||
def __init__(self, name, parent, additional_arg):
|
|
||||||
super().__init__(name, parent)
|
|
||||||
self.additional_arg = additional_arg
|
|
||||||
|
|
||||||
should be turned into:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
class CustomItem(pytest.Item):
|
|
||||||
def __init__(self, *, additional_arg, **kwargs):
|
|
||||||
super().__init__(**kwargs)
|
|
||||||
self.additional_arg = additional_arg
|
|
||||||
|
|
||||||
to avoid hard-coding the arguments pytest can pass to the superclass.
|
|
||||||
See :ref:`non-python tests` for a full example.
|
|
||||||
|
|
||||||
For cases without conflicts, no deprecation warning is emitted. For cases with
|
|
||||||
conflicts (such as :class:`pytest.File` now taking ``path`` instead of
|
|
||||||
``fspath``, as :ref:`outlined above <node-ctor-fspath-deprecation>`), a
|
|
||||||
deprecation warning is now raised.
|
|
||||||
|
|
||||||
Backward compatibilities in ``Parser.addoption``
|
Backward compatibilities in ``Parser.addoption``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -386,62 +49,24 @@ Backward compatibilities in ``Parser.addoption``
|
|||||||
.. deprecated:: 2.4
|
.. deprecated:: 2.4
|
||||||
|
|
||||||
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
|
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
|
||||||
scheduled for removal in pytest 8 (deprecated since pytest 2.4.0):
|
scheduled for removal in pytest 7 (deprecated since pytest 2.4.0):
|
||||||
|
|
||||||
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
|
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
|
||||||
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.
|
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.
|
||||||
|
|
||||||
|
|
||||||
Using ``pytest.warns(None)``
|
Raising ``unittest.SkipTest`` during collection
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
.. deprecated:: 6.3
|
||||||
|
|
||||||
:func:`pytest.warns(None) <pytest.warns>` is now deprecated because it was frequently misused.
|
Raising :class:`unittest.SkipTest` to skip collection of tests during the
|
||||||
Its correct usage was checking that the code emits at least one warning of any type - like ``pytest.warns()``
|
pytest collection phase is deprecated. Use :func:`pytest.skip` instead.
|
||||||
or ``pytest.warns(Warning)``.
|
|
||||||
|
|
||||||
See :ref:`warns use cases` for examples.
|
Note: This deprecation only relates to using `unittest.SkipTest` during test
|
||||||
|
collection. You are probably not doing that. Ordinary usage of
|
||||||
|
:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` /
|
||||||
Returning non-None value in test functions
|
:func:`unittest.skip` in unittest test cases is fully supported.
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 7.2
|
|
||||||
|
|
||||||
A :class:`pytest.PytestReturnNotNoneWarning` is now emitted if a test function returns something other than `None`.
|
|
||||||
|
|
||||||
This prevents a common mistake among beginners that expect that returning a `bool` would cause a test to pass or fail, for example:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
["a", "b", "result"],
|
|
||||||
[
|
|
||||||
[1, 2, 5],
|
|
||||||
[2, 3, 8],
|
|
||||||
[5, 3, 18],
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_foo(a, b, result):
|
|
||||||
return foo(a, b) == result
|
|
||||||
|
|
||||||
Given that pytest ignores the return value, this might be surprising that it will never fail.
|
|
||||||
|
|
||||||
The proper fix is to change the `return` to an `assert`:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
["a", "b", "result"],
|
|
||||||
[
|
|
||||||
[1, 2, 5],
|
|
||||||
[2, 3, 8],
|
|
||||||
[5, 3, 18],
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_foo(a, b, result):
|
|
||||||
assert foo(a, b) == result
|
|
||||||
|
|
||||||
|
|
||||||
The ``--strict`` command-line option
|
The ``--strict`` command-line option
|
||||||
@@ -467,42 +92,29 @@ The ``yield_fixture`` function/decorator
|
|||||||
It has been so for a very long time, so can be search/replaced safely.
|
It has been so for a very long time, so can be search/replaced safely.
|
||||||
|
|
||||||
|
|
||||||
Removed Features
|
The ``pytest_warning_captured`` hook
|
||||||
----------------
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
|
.. deprecated:: 6.0
|
||||||
an appropriate period of deprecation has passed.
|
|
||||||
|
|
||||||
|
This hook has an `item` parameter which cannot be serialized by ``pytest-xdist``.
|
||||||
|
|
||||||
|
Use the ``pytest_warning_recored`` hook instead, which replaces the ``item`` parameter
|
||||||
|
by a ``nodeid`` parameter.
|
||||||
|
|
||||||
The ``pytest.collect`` module
|
The ``pytest.collect`` module
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. deprecated:: 6.0
|
.. deprecated:: 6.0
|
||||||
.. versionremoved:: 7.0
|
|
||||||
|
|
||||||
The ``pytest.collect`` module is no longer part of the public API, all its names
|
The ``pytest.collect`` module is no longer part of the public API, all its names
|
||||||
should now be imported from ``pytest`` directly instead.
|
should now be imported from ``pytest`` directly instead.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The ``pytest_warning_captured`` hook
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 6.0
|
|
||||||
.. versionremoved:: 7.0
|
|
||||||
|
|
||||||
This hook has an `item` parameter which cannot be serialized by ``pytest-xdist``.
|
|
||||||
|
|
||||||
Use the ``pytest_warning_recorded`` hook instead, which replaces the ``item`` parameter
|
|
||||||
by a ``nodeid`` parameter.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The ``pytest._fillfuncargs`` function
|
The ``pytest._fillfuncargs`` function
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. deprecated:: 6.0
|
.. deprecated:: 6.0
|
||||||
.. versionremoved:: 7.0
|
|
||||||
|
|
||||||
This function was kept for backward compatibility with an older plugin.
|
This function was kept for backward compatibility with an older plugin.
|
||||||
|
|
||||||
@@ -511,6 +123,12 @@ it, use `function._request._fillfixtures()` instead, though note this is not
|
|||||||
a public API and may break in the future.
|
a public API and may break in the future.
|
||||||
|
|
||||||
|
|
||||||
|
Removed Features
|
||||||
|
----------------
|
||||||
|
|
||||||
|
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
|
||||||
|
an appropriate period of deprecation has passed.
|
||||||
|
|
||||||
``--no-print-logs`` command-line option
|
``--no-print-logs`` command-line option
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -525,7 +143,6 @@ A ``--show-capture`` command-line option was added in ``pytest 3.5.0`` which all
|
|||||||
display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default).
|
display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default).
|
||||||
|
|
||||||
|
|
||||||
.. _resultlog deprecated:
|
|
||||||
|
|
||||||
Result log (``--result-log``)
|
Result log (``--result-log``)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -548,8 +165,8 @@ at some point, depending on the plans for the plugins and number of users using
|
|||||||
|
|
||||||
.. versionremoved:: 6.0
|
.. versionremoved:: 6.0
|
||||||
|
|
||||||
The ``pytest_collect_directory`` hook has not worked properly for years (it was called
|
The ``pytest_collect_directory`` has not worked properly for years (it was called
|
||||||
but the results were ignored). Users may consider using :hook:`pytest_collection_modifyitems` instead.
|
but the results were ignored). Users may consider using :func:`pytest_collection_modifyitems <_pytest.hookspec.pytest_collection_modifyitems>` instead.
|
||||||
|
|
||||||
TerminalReporter.writer
|
TerminalReporter.writer
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -563,8 +180,6 @@ with ``py.io.TerminalWriter``.
|
|||||||
Plugins that used ``TerminalReporter.writer`` directly should instead use ``TerminalReporter``
|
Plugins that used ``TerminalReporter.writer`` directly should instead use ``TerminalReporter``
|
||||||
methods that provide the same functionality.
|
methods that provide the same functionality.
|
||||||
|
|
||||||
.. _junit-family changed default value:
|
|
||||||
|
|
||||||
``junit_family`` default value change to "xunit2"
|
``junit_family`` default value change to "xunit2"
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -652,8 +267,6 @@ in places where we or plugin authors must distinguish between fixture names and
|
|||||||
names supplied by non-fixture things such as ``pytest.mark.parametrize``.
|
names supplied by non-fixture things such as ``pytest.mark.parametrize``.
|
||||||
|
|
||||||
|
|
||||||
.. _pytest.config global deprecated:
|
|
||||||
|
|
||||||
``pytest.config`` global
|
``pytest.config`` global
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -698,7 +311,7 @@ Becomes:
|
|||||||
|
|
||||||
|
|
||||||
If you still have concerns about this deprecation and future removal, please comment on
|
If you still have concerns about this deprecation and future removal, please comment on
|
||||||
:issue:`3974`.
|
`issue #3974 <https://github.com/pytest-dev/pytest/issues/3974>`__.
|
||||||
|
|
||||||
|
|
||||||
.. _raises-warns-exec:
|
.. _raises-warns-exec:
|
||||||
@@ -751,8 +364,6 @@ This issue should affect only advanced plugins who create new collection types,
|
|||||||
message please contact the authors so they can change the code.
|
message please contact the authors so they can change the code.
|
||||||
|
|
||||||
|
|
||||||
.. _marks in pytest.parametrize deprecated:
|
|
||||||
|
|
||||||
marks in ``pytest.mark.parametrize``
|
marks in ``pytest.mark.parametrize``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -801,8 +412,6 @@ To update the code, use ``pytest.param``:
|
|||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
.. _pytest_funcarg__ prefix deprecated:
|
|
||||||
|
|
||||||
``pytest_funcarg__`` prefix
|
``pytest_funcarg__`` prefix
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -834,8 +443,6 @@ Switch over to the ``@pytest.fixture`` decorator:
|
|||||||
to avoid conflicts with other distutils commands.
|
to avoid conflicts with other distutils commands.
|
||||||
|
|
||||||
|
|
||||||
.. _metafunc.addcall deprecated:
|
|
||||||
|
|
||||||
Metafunc.addcall
|
Metafunc.addcall
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -860,8 +467,6 @@ Becomes:
|
|||||||
metafunc.parametrize("i", [1, 2], ids=["1", "2"])
|
metafunc.parametrize("i", [1, 2], ids=["1", "2"])
|
||||||
|
|
||||||
|
|
||||||
.. _cached_setup deprecated:
|
|
||||||
|
|
||||||
``cached_setup``
|
``cached_setup``
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -890,12 +495,10 @@ This should be updated to make use of standard fixture mechanisms:
|
|||||||
session.close()
|
session.close()
|
||||||
|
|
||||||
|
|
||||||
You can consult :std:doc:`funcarg comparison section in the docs <funcarg_compare>` for
|
You can consult `funcarg comparison section in the docs <https://docs.pytest.org/en/stable/funcarg_compare.html>`_ for
|
||||||
more information.
|
more information.
|
||||||
|
|
||||||
|
|
||||||
.. _pytest_plugins in non-top-level conftest files deprecated:
|
|
||||||
|
|
||||||
pytest_plugins in non-top-level conftest files
|
pytest_plugins in non-top-level conftest files
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -906,8 +509,6 @@ files because they will activate referenced plugins *globally*, which is surpris
|
|||||||
features ``conftest.py`` files are only *active* for tests at or below it.
|
features ``conftest.py`` files are only *active* for tests at or below it.
|
||||||
|
|
||||||
|
|
||||||
.. _config.warn and node.warn deprecated:
|
|
||||||
|
|
||||||
``Config.warn`` and ``Node.warn``
|
``Config.warn`` and ``Node.warn``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -935,8 +536,6 @@ Becomes:
|
|||||||
|
|
||||||
* ``node.warn("CI", "some message")``: this code/message form has been **removed** and should be converted to the warning instance form above.
|
* ``node.warn("CI", "some message")``: this code/message form has been **removed** and should be converted to the warning instance form above.
|
||||||
|
|
||||||
.. _record_xml_property deprecated:
|
|
||||||
|
|
||||||
record_xml_property
|
record_xml_property
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -960,8 +559,6 @@ Change to:
|
|||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
.. _passing command-line string to pytest.main deprecated:
|
|
||||||
|
|
||||||
Passing command-line string to ``pytest.main()``
|
Passing command-line string to ``pytest.main()``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -984,8 +581,6 @@ By passing a string, users expect that pytest will interpret that command-line u
|
|||||||
on (for example ``bash`` or ``Powershell``), but this is very hard/impossible to do in a portable way.
|
on (for example ``bash`` or ``Powershell``), but this is very hard/impossible to do in a portable way.
|
||||||
|
|
||||||
|
|
||||||
.. _calling fixtures directly deprecated:
|
|
||||||
|
|
||||||
Calling fixtures directly
|
Calling fixtures directly
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -1039,8 +634,6 @@ with the ``name`` parameter:
|
|||||||
return cell()
|
return cell()
|
||||||
|
|
||||||
|
|
||||||
.. _yield tests deprecated:
|
|
||||||
|
|
||||||
``yield`` tests
|
``yield`` tests
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -1069,8 +662,6 @@ This form of test function doesn't support fixtures properly, and users should s
|
|||||||
def test_squared(x, y):
|
def test_squared(x, y):
|
||||||
assert x ** x == y
|
assert x ** x == y
|
||||||
|
|
||||||
.. _internal classes accessed through node deprecated:
|
|
||||||
|
|
||||||
Internal classes accessed through ``Node``
|
Internal classes accessed through ``Node``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -1105,8 +696,6 @@ As part of a large :ref:`marker-revamp` we already deprecated using ``MarkInfo``
|
|||||||
the only correct way to get markers of an element is via ``node.iter_markers(name)``.
|
the only correct way to get markers of an element is via ``node.iter_markers(name)``.
|
||||||
|
|
||||||
|
|
||||||
.. _pytest.namespace deprecated:
|
|
||||||
|
|
||||||
``pytest_namespace``
|
``pytest_namespace``
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ example: specifying and selecting acceptance tests
|
|||||||
self.tmpdir = request.config.mktemp(request.function.__name__, numbered=True)
|
self.tmpdir = request.config.mktemp(request.function.__name__, numbered=True)
|
||||||
|
|
||||||
def run(self, *cmd):
|
def run(self, *cmd):
|
||||||
"""called by test code to execute an acceptance test."""
|
""" called by test code to execute an acceptance test. """
|
||||||
self.tmpdir.chdir()
|
self.tmpdir.chdir()
|
||||||
return subprocess.check_output(cmd).decode()
|
return subprocess.check_output(cmd).decode()
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="572" height="542">
|
<svg xmlns="http://www.w3.org/2000/svg" width="572" height="542">
|
||||||
<style>
|
<style>
|
||||||
text {
|
text {
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<path d="M 26,271 A 260 260 0 0 1 546 271" id="testp"/>
|
<path d="M 26,271 A 260 260 0 0 1 546 271" id="testp"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="package">
|
<text class="package">
|
||||||
<textPath xlink:href="#testp" startOffset="50%">tests</textPath>
|
<textPath href="#testp" startOffset="50%">tests</textPath>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<!-- subpackage -->
|
<!-- subpackage -->
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<path d="M 56,271 A 130 130 0 0 1 316 271" id="subpackage"/>
|
<path d="M 56,271 A 130 130 0 0 1 316 271" id="subpackage"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="package">
|
<text class="package">
|
||||||
<textPath xlink:href="#subpackage" startOffset="50%">subpackage</textPath>
|
<textPath href="#subpackage" startOffset="50%">subpackage</textPath>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<!-- test_subpackage.py -->
|
<!-- test_subpackage.py -->
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<path d="M 106,311 A 80 80 0 0 1 266 311" id="testSubpackage"/>
|
<path d="M 106,311 A 80 80 0 0 1 266 311" id="testSubpackage"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="module">
|
<text class="module">
|
||||||
<textPath xlink:href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath>
|
<textPath href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- innermost -->
|
<!-- innermost -->
|
||||||
<line x1="186" x2="186" y1="271" y2="351"/>
|
<line x1="186" x2="186" y1="271" y2="351"/>
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<path d="M 366,271 A 75 75 0 0 1 516 271" id="testTop"/>
|
<path d="M 366,271 A 75 75 0 0 1 516 271" id="testTop"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="module">
|
<text class="module">
|
||||||
<textPath xlink:href="#testTop" startOffset="50%">test_top.py</textPath>
|
<textPath href="#testTop" startOffset="50%">test_top.py</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- innermost -->
|
<!-- innermost -->
|
||||||
<line x1="441" x2="441" y1="306" y2="236"/>
|
<line x1="441" x2="441" y1="306" y2="236"/>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="587" height="382">
|
<svg xmlns="http://www.w3.org/2000/svg" width="587" height="382">
|
||||||
<style>
|
<style>
|
||||||
text {
|
text {
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<path d="M 411,86 A 75 75 0 0 1 561 86" id="pluginA"/>
|
<path d="M 411,86 A 75 75 0 0 1 561 86" id="pluginA"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="plugin">
|
<text class="plugin">
|
||||||
<textPath xlink:href="#pluginA" startOffset="50%">plugin_a</textPath>
|
<textPath href="#pluginA" startOffset="50%">plugin_a</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- scope order number -->
|
<!-- scope order number -->
|
||||||
<mask id="pluginAOrderMask">
|
<mask id="pluginAOrderMask">
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<path d="M 411,296 A 75 75 0 0 1 561 296" id="pluginB"/>
|
<path d="M 411,296 A 75 75 0 0 1 561 296" id="pluginB"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="plugin">
|
<text class="plugin">
|
||||||
<textPath xlink:href="#pluginB" startOffset="50%">plugin_b</textPath>
|
<textPath href="#pluginB" startOffset="50%">plugin_b</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- scope order number -->
|
<!-- scope order number -->
|
||||||
<mask id="pluginBOrderMask">
|
<mask id="pluginBOrderMask">
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<path d="M 11,191 A 180 180 0 0 1 371 191" id="testp"/>
|
<path d="M 11,191 A 180 180 0 0 1 371 191" id="testp"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="package">
|
<text class="package">
|
||||||
<textPath xlink:href="#testp" startOffset="50%">tests</textPath>
|
<textPath href="#testp" startOffset="50%">tests</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- scope order number -->
|
<!-- scope order number -->
|
||||||
<mask id="mainOrderMask">
|
<mask id="mainOrderMask">
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<path d="M 61,231 A 130 130 0 0 1 321 231" id="subpackage"/>
|
<path d="M 61,231 A 130 130 0 0 1 321 231" id="subpackage"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="package">
|
<text class="package">
|
||||||
<textPath xlink:href="#subpackage" startOffset="50%">subpackage</textPath>
|
<textPath href="#subpackage" startOffset="50%">subpackage</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- scope order number -->
|
<!-- scope order number -->
|
||||||
<mask id="subpackageOrderMask">
|
<mask id="subpackageOrderMask">
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
<path d="M 111,271 A 80 80 0 0 1 271 271" id="testSubpackage"/>
|
<path d="M 111,271 A 80 80 0 0 1 271 271" id="testSubpackage"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="module">
|
<text class="module">
|
||||||
<textPath xlink:href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath>
|
<textPath href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- scope order number -->
|
<!-- scope order number -->
|
||||||
<mask id="testSubpackageOrderMask">
|
<mask id="testSubpackageOrderMask">
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.3 KiB |
@@ -1,56 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="112" height="682">
|
|
||||||
<style>
|
|
||||||
text {
|
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
|
||||||
dominant-baseline: middle;
|
|
||||||
text-anchor: middle;
|
|
||||||
fill: #062886;
|
|
||||||
font-size: medium;
|
|
||||||
}
|
|
||||||
ellipse.fixture, rect.test {
|
|
||||||
fill: #eeffcc;
|
|
||||||
stroke: #007020;
|
|
||||||
stroke-width: 2;
|
|
||||||
}
|
|
||||||
text.fixture {
|
|
||||||
color: #06287e;
|
|
||||||
}
|
|
||||||
circle.class {
|
|
||||||
fill: #c3e0ec;
|
|
||||||
stroke: #0e84b5;
|
|
||||||
stroke-width: 2;
|
|
||||||
}
|
|
||||||
text.class {
|
|
||||||
fill: #0e84b5;
|
|
||||||
}
|
|
||||||
path, line {
|
|
||||||
stroke: black;
|
|
||||||
stroke-width: 2;
|
|
||||||
fill: none;
|
|
||||||
}
|
|
||||||
rect.autouse {
|
|
||||||
fill: #ca7f3d;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<line x1="56" x2="56" y1="681" y2="26" />
|
|
||||||
<ellipse class="fixture" rx="50" ry="25" cx="56" cy="26" />
|
|
||||||
<text x="56" y="26">order</text>
|
|
||||||
<ellipse class="fixture" rx="25" ry="25" cx="56" cy="96" />
|
|
||||||
<text x="56" y="96">a</text>
|
|
||||||
<ellipse class="fixture" rx="25" ry="25" cx="56" cy="166" />
|
|
||||||
<text x="56" y="166">b</text>
|
|
||||||
<ellipse class="fixture" rx="25" ry="25" cx="56" cy="236" />
|
|
||||||
<text x="56" y="236">c</text>
|
|
||||||
<rect class="autouse" width="112" height="40" x="0" y="286" />
|
|
||||||
<text x="56" y="306">autouse</text>
|
|
||||||
<ellipse class="fixture" rx="25" ry="25" cx="56" cy="376" />
|
|
||||||
<text x="56" y="376">d</text>
|
|
||||||
<ellipse class="fixture" rx="25" ry="25" cx="56" cy="446" />
|
|
||||||
<text x="56" y="446">e</text>
|
|
||||||
<ellipse class="fixture" rx="25" ry="25" cx="56" cy="516" />
|
|
||||||
<text x="56" y="516">f</text>
|
|
||||||
<ellipse class="fixture" rx="25" ry="25" cx="56" cy="586" />
|
|
||||||
<text x="56" y="586">g</text>
|
|
||||||
<rect class="test" width="110" height="50" x="1" y="631" />
|
|
||||||
<text x="56" y="656">test_order</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="862" height="402">
|
<svg xmlns="http://www.w3.org/2000/svg" width="862" height="402">
|
||||||
<style>
|
<style>
|
||||||
text {
|
text {
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<path d="M31,201 A 190 190 0 0 1 411 201" id="testClassWith"/>
|
<path d="M31,201 A 190 190 0 0 1 411 201" id="testClassWith"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="class">
|
<text class="class">
|
||||||
<textPath xlink:href="#testClassWith" startOffset="50%">TestWithC1Request</textPath>
|
<textPath href="#testClassWith" startOffset="50%">TestWithC1Request</textPath>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<!-- TestWithoutC1Request -->
|
<!-- TestWithoutC1Request -->
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
<path d="M451,201 A 190 190 0 0 1 831 201" id="testClassWithout"/>
|
<path d="M451,201 A 190 190 0 0 1 831 201" id="testClassWithout"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="class">
|
<text class="class">
|
||||||
<textPath xlink:href="#testClassWithout" startOffset="50%">TestWithoutC1Request</textPath>
|
<textPath href="#testClassWithout" startOffset="50%">TestWithoutC1Request</textPath>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<rect class="autouse" width="862" height="40" x="1" y="181" />
|
<rect class="autouse" width="862" height="40" x="1" y="181" />
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="862" height="502">
|
<svg xmlns="http://www.w3.org/2000/svg" width="862" height="502">
|
||||||
<style>
|
<style>
|
||||||
text {
|
text {
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<path d="M11,251 A 240 240 0 0 1 491 251" id="testClassWith"/>
|
<path d="M11,251 A 240 240 0 0 1 491 251" id="testClassWith"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="class">
|
<text class="class">
|
||||||
<textPath xlink:href="#testClassWith" startOffset="50%">TestWithAutouse</textPath>
|
<textPath href="#testClassWith" startOffset="50%">TestWithAutouse</textPath>
|
||||||
</text>
|
</text>
|
||||||
<mask id="autouseScope">
|
<mask id="autouseScope">
|
||||||
<circle fill="white" r="249" cx="251" cy="251" />
|
<circle fill="white" r="249" cx="251" cy="251" />
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<path d="M 531,251 A 160 160 0 0 1 851 251" id="testClassWithout"/>
|
<path d="M 531,251 A 160 160 0 0 1 851 251" id="testClassWithout"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="class">
|
<text class="class">
|
||||||
<textPath xlink:href="#testClassWithout" startOffset="50%">TestWithoutAutouse</textPath>
|
<textPath href="#testClassWithout" startOffset="50%">TestWithoutAutouse</textPath>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<!-- TestWithoutAutouse.test_req -->
|
<!-- TestWithoutAutouse.test_req -->
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="262" height="537">
|
<svg xmlns="http://www.w3.org/2000/svg" width="262" height="537">
|
||||||
<style>
|
<style>
|
||||||
text {
|
text {
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||||
@@ -50,6 +50,6 @@
|
|||||||
<path d="M131,526 A 120 120 0 0 1 136 286" id="testClass"/>
|
<path d="M131,526 A 120 120 0 0 1 136 286" id="testClass"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="class">
|
<text class="class">
|
||||||
<textPath xlink:href="#testClass" startOffset="50%">TestClass</textPath>
|
<textPath href="#testClass" startOffset="50%">TestClass</textPath>
|
||||||
</text>
|
</text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="562" height="532">
|
<svg xmlns="http://www.w3.org/2000/svg" width="562" height="532">
|
||||||
<style>
|
<style>
|
||||||
text {
|
text {
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
<path d="M 26,266 A 255 255 0 0 1 536 266" id="testModule"/>
|
<path d="M 26,266 A 255 255 0 0 1 536 266" id="testModule"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="module">
|
<text class="module">
|
||||||
<textPath xlink:href="#testModule" startOffset="50%">test_fixtures_request_different_scope.py</textPath>
|
<textPath href="#testModule" startOffset="50%">test_fixtures_request_different_scope.py</textPath>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<!-- TestOne -->
|
<!-- TestOne -->
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<path d="M 51,266 A 90 90 0 0 1 231 266" id="testOne"/>
|
<path d="M 51,266 A 90 90 0 0 1 231 266" id="testOne"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="class">
|
<text class="class">
|
||||||
<textPath xlink:href="#testOne" startOffset="50%">TestOne</textPath>
|
<textPath href="#testOne" startOffset="50%">TestOne</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- scope order number -->
|
<!-- scope order number -->
|
||||||
<mask id="testOneOrderMask">
|
<mask id="testOneOrderMask">
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
<path d="M 331,266 A 90 90 0 0 1 511 266" id="testTwo"/>
|
<path d="M 331,266 A 90 90 0 0 1 511 266" id="testTwo"/>
|
||||||
</defs>
|
</defs>
|
||||||
<text class="class">
|
<text class="class">
|
||||||
<textPath xlink:href="#testTwo" startOffset="50%">TestTwo</textPath>
|
<textPath href="#testTwo" startOffset="50%">TestTwo</textPath>
|
||||||
</text>
|
</text>
|
||||||
<!-- scope order number -->
|
<!-- scope order number -->
|
||||||
<mask id="testTwoOrderMask">
|
<mask id="testTwoOrderMask">
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -45,9 +45,9 @@ You can then restrict a test run to only run tests marked with ``webtest``:
|
|||||||
|
|
||||||
$ pytest -v -m webtest
|
$ pytest -v -m webtest
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 4 items / 3 deselected / 1 selected
|
collecting ... collected 4 items / 3 deselected / 1 selected
|
||||||
|
|
||||||
test_server.py::test_send_http PASSED [100%]
|
test_server.py::test_send_http PASSED [100%]
|
||||||
@@ -60,9 +60,9 @@ Or the inverse, running all tests except the webtest ones:
|
|||||||
|
|
||||||
$ pytest -v -m "not webtest"
|
$ pytest -v -m "not webtest"
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 4 items / 1 deselected / 3 selected
|
collecting ... collected 4 items / 1 deselected / 3 selected
|
||||||
|
|
||||||
test_server.py::test_something_quick PASSED [ 33%]
|
test_server.py::test_something_quick PASSED [ 33%]
|
||||||
@@ -82,9 +82,9 @@ tests based on their module, class, method, or function name:
|
|||||||
|
|
||||||
$ pytest -v test_server.py::TestClass::test_method
|
$ pytest -v test_server.py::TestClass::test_method
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 1 item
|
collecting ... collected 1 item
|
||||||
|
|
||||||
test_server.py::TestClass::test_method PASSED [100%]
|
test_server.py::TestClass::test_method PASSED [100%]
|
||||||
@@ -97,9 +97,9 @@ You can also select on the class:
|
|||||||
|
|
||||||
$ pytest -v test_server.py::TestClass
|
$ pytest -v test_server.py::TestClass
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 1 item
|
collecting ... collected 1 item
|
||||||
|
|
||||||
test_server.py::TestClass::test_method PASSED [100%]
|
test_server.py::TestClass::test_method PASSED [100%]
|
||||||
@@ -112,9 +112,9 @@ Or select multiple nodes:
|
|||||||
|
|
||||||
$ pytest -v test_server.py::TestClass test_server.py::test_send_http
|
$ pytest -v test_server.py::TestClass test_server.py::test_send_http
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 2 items
|
collecting ... collected 2 items
|
||||||
|
|
||||||
test_server.py::TestClass::test_method PASSED [ 50%]
|
test_server.py::TestClass::test_method PASSED [ 50%]
|
||||||
@@ -156,9 +156,9 @@ The expression matching is now case-insensitive.
|
|||||||
|
|
||||||
$ pytest -v -k http # running with the above defined example module
|
$ pytest -v -k http # running with the above defined example module
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 4 items / 3 deselected / 1 selected
|
collecting ... collected 4 items / 3 deselected / 1 selected
|
||||||
|
|
||||||
test_server.py::test_send_http PASSED [100%]
|
test_server.py::test_send_http PASSED [100%]
|
||||||
@@ -171,9 +171,9 @@ And you can also run all tests except the ones that match the keyword:
|
|||||||
|
|
||||||
$ pytest -k "not send_http" -v
|
$ pytest -k "not send_http" -v
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 4 items / 1 deselected / 3 selected
|
collecting ... collected 4 items / 1 deselected / 3 selected
|
||||||
|
|
||||||
test_server.py::test_something_quick PASSED [ 33%]
|
test_server.py::test_something_quick PASSED [ 33%]
|
||||||
@@ -188,9 +188,9 @@ Or to select "http" and "quick" tests:
|
|||||||
|
|
||||||
$ pytest -k "http or quick" -v
|
$ pytest -k "http or quick" -v
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collecting ... collected 4 items / 2 deselected / 2 selected
|
collecting ... collected 4 items / 2 deselected / 2 selected
|
||||||
|
|
||||||
test_server.py::test_send_http PASSED [ 50%]
|
test_server.py::test_send_http PASSED [ 50%]
|
||||||
@@ -234,21 +234,21 @@ You can ask which markers exist for your test suite - the list includes our just
|
|||||||
|
|
||||||
@pytest.mark.slow: mark test as slow.
|
@pytest.mark.slow: mark test as slow.
|
||||||
|
|
||||||
@pytest.mark.filterwarnings(warning): add a warning filter to the given test. see https://docs.pytest.org/en/stable/how-to/capture-warnings.html#pytest-mark-filterwarnings
|
@pytest.mark.filterwarnings(warning): add a warning filter to the given test. see https://docs.pytest.org/en/stable/warnings.html#pytest-mark-filterwarnings
|
||||||
|
|
||||||
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
|
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
|
||||||
|
|
||||||
@pytest.mark.skipif(condition, ..., *, reason=...): skip the given test function if any of the conditions evaluate to True. Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-skipif
|
@pytest.mark.skipif(condition, ..., *, reason=...): skip the given test function if any of the conditions evaluate to True. Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-skipif
|
||||||
|
|
||||||
@pytest.mark.xfail(condition, ..., *, reason=..., run=True, raises=None, strict=xfail_strict): mark the test function as an expected failure if any of the conditions evaluate to True. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-xfail
|
@pytest.mark.xfail(condition, ..., *, reason=..., run=True, raises=None, strict=xfail_strict): mark the test function as an expected failure if any of the conditions evaluate to True. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-xfail
|
||||||
|
|
||||||
@pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/how-to/parametrize.html for more info and examples.
|
@pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/parametrize.html for more info and examples.
|
||||||
|
|
||||||
@pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/explanation/fixtures.html#usefixtures
|
@pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/fixture.html#usefixtures
|
||||||
|
|
||||||
@pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. DEPRECATED, use @pytest.hookimpl(tryfirst=True) instead.
|
@pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible.
|
||||||
|
|
||||||
@pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. DEPRECATED, use @pytest.hookimpl(trylast=True) instead.
|
@pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible.
|
||||||
|
|
||||||
|
|
||||||
For an example on how to add and work with markers from a plugin, see
|
For an example on how to add and work with markers from a plugin, see
|
||||||
@@ -346,7 +346,7 @@ Custom marker and command line option to control test runs
|
|||||||
Plugins can provide custom markers and implement specific behaviour
|
Plugins can provide custom markers and implement specific behaviour
|
||||||
based on it. This is a self-contained example which adds a command
|
based on it. This is a self-contained example which adds a command
|
||||||
line option and a parametrized test function marker to run tests
|
line option and a parametrized test function marker to run tests
|
||||||
specified via named environments:
|
specifies via named environments:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ specified via named environments:
|
|||||||
envnames = [mark.args[0] for mark in item.iter_markers(name="env")]
|
envnames = [mark.args[0] for mark in item.iter_markers(name="env")]
|
||||||
if envnames:
|
if envnames:
|
||||||
if item.config.getoption("-E") not in envnames:
|
if item.config.getoption("-E") not in envnames:
|
||||||
pytest.skip(f"test requires env in {envnames!r}")
|
pytest.skip("test requires env in {!r}".format(envnames))
|
||||||
|
|
||||||
A test file using this local plugin:
|
A test file using this local plugin:
|
||||||
|
|
||||||
@@ -397,8 +397,9 @@ the test needs:
|
|||||||
|
|
||||||
$ pytest -E stage2
|
$ pytest -E stage2
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collected 1 item
|
collected 1 item
|
||||||
|
|
||||||
test_someenv.py s [100%]
|
test_someenv.py s [100%]
|
||||||
@@ -411,8 +412,9 @@ and here is one that specifies exactly the environment needed:
|
|||||||
|
|
||||||
$ pytest -E stage1
|
$ pytest -E stage1
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collected 1 item
|
collected 1 item
|
||||||
|
|
||||||
test_someenv.py . [100%]
|
test_someenv.py . [100%]
|
||||||
@@ -426,21 +428,21 @@ The ``--markers`` option always gives you a list of available markers:
|
|||||||
$ pytest --markers
|
$ pytest --markers
|
||||||
@pytest.mark.env(name): mark test to run only on named environment
|
@pytest.mark.env(name): mark test to run only on named environment
|
||||||
|
|
||||||
@pytest.mark.filterwarnings(warning): add a warning filter to the given test. see https://docs.pytest.org/en/stable/how-to/capture-warnings.html#pytest-mark-filterwarnings
|
@pytest.mark.filterwarnings(warning): add a warning filter to the given test. see https://docs.pytest.org/en/stable/warnings.html#pytest-mark-filterwarnings
|
||||||
|
|
||||||
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
|
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
|
||||||
|
|
||||||
@pytest.mark.skipif(condition, ..., *, reason=...): skip the given test function if any of the conditions evaluate to True. Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-skipif
|
@pytest.mark.skipif(condition, ..., *, reason=...): skip the given test function if any of the conditions evaluate to True. Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-skipif
|
||||||
|
|
||||||
@pytest.mark.xfail(condition, ..., *, reason=..., run=True, raises=None, strict=xfail_strict): mark the test function as an expected failure if any of the conditions evaluate to True. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-xfail
|
@pytest.mark.xfail(condition, ..., *, reason=..., run=True, raises=None, strict=xfail_strict): mark the test function as an expected failure if any of the conditions evaluate to True. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-xfail
|
||||||
|
|
||||||
@pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/how-to/parametrize.html for more info and examples.
|
@pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/parametrize.html for more info and examples.
|
||||||
|
|
||||||
@pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/explanation/fixtures.html#usefixtures
|
@pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/fixture.html#usefixtures
|
||||||
|
|
||||||
@pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. DEPRECATED, use @pytest.hookimpl(tryfirst=True) instead.
|
@pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible.
|
||||||
|
|
||||||
@pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. DEPRECATED, use @pytest.hookimpl(trylast=True) instead.
|
@pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible.
|
||||||
|
|
||||||
|
|
||||||
.. _`passing callables to custom markers`:
|
.. _`passing callables to custom markers`:
|
||||||
@@ -486,7 +488,7 @@ The output is as follows:
|
|||||||
.. code-block:: pytest
|
.. code-block:: pytest
|
||||||
|
|
||||||
$ pytest -q -s
|
$ pytest -q -s
|
||||||
Mark(name='my_marker', args=(<function hello_world at 0xdeadbeef0001>,), kwargs={})
|
Mark(name='my_marker', args=(<function hello_world at 0xdeadbeef>,), kwargs={})
|
||||||
.
|
.
|
||||||
1 passed in 0.12s
|
1 passed in 0.12s
|
||||||
|
|
||||||
@@ -528,7 +530,7 @@ test function. From a conftest file we can read it like this:
|
|||||||
|
|
||||||
def pytest_runtest_setup(item):
|
def pytest_runtest_setup(item):
|
||||||
for mark in item.iter_markers(name="glob"):
|
for mark in item.iter_markers(name="glob"):
|
||||||
print(f"glob args={mark.args} kwargs={mark.kwargs}")
|
print("glob args={} kwargs={}".format(mark.args, mark.kwargs))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
Let's run this without capturing output and see what we get:
|
Let's run this without capturing output and see what we get:
|
||||||
@@ -558,7 +560,6 @@ for your particular platform, you could use the following plugin:
|
|||||||
# content of conftest.py
|
# content of conftest.py
|
||||||
#
|
#
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
ALL = set("darwin linux win32".split())
|
ALL = set("darwin linux win32".split())
|
||||||
@@ -568,7 +569,7 @@ for your particular platform, you could use the following plugin:
|
|||||||
supported_platforms = ALL.intersection(mark.name for mark in item.iter_markers())
|
supported_platforms = ALL.intersection(mark.name for mark in item.iter_markers())
|
||||||
plat = sys.platform
|
plat = sys.platform
|
||||||
if supported_platforms and plat not in supported_platforms:
|
if supported_platforms and plat not in supported_platforms:
|
||||||
pytest.skip(f"cannot run on platform {plat}")
|
pytest.skip("cannot run on platform {}".format(plat))
|
||||||
|
|
||||||
then tests will be skipped if they were specified for a different platform.
|
then tests will be skipped if they were specified for a different platform.
|
||||||
Let's do a little test file to show how this looks like:
|
Let's do a little test file to show how this looks like:
|
||||||
@@ -604,14 +605,15 @@ then you will see two tests skipped and two executed tests as expected:
|
|||||||
|
|
||||||
$ pytest -rs # this option reports skip reasons
|
$ pytest -rs # this option reports skip reasons
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collected 4 items
|
collected 4 items
|
||||||
|
|
||||||
test_plat.py s.s. [100%]
|
test_plat.py s.s. [100%]
|
||||||
|
|
||||||
========================= short test summary info ==========================
|
========================= short test summary info ==========================
|
||||||
SKIPPED [2] conftest.py:13: cannot run on platform linux
|
SKIPPED [2] conftest.py:12: cannot run on platform linux
|
||||||
======================= 2 passed, 2 skipped in 0.12s =======================
|
======================= 2 passed, 2 skipped in 0.12s =======================
|
||||||
|
|
||||||
Note that if you specify a platform via the marker-command line option like this:
|
Note that if you specify a platform via the marker-command line option like this:
|
||||||
@@ -620,8 +622,9 @@ Note that if you specify a platform via the marker-command line option like this
|
|||||||
|
|
||||||
$ pytest -m linux
|
$ pytest -m linux
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collected 4 items / 3 deselected / 1 selected
|
collected 4 items / 3 deselected / 1 selected
|
||||||
|
|
||||||
test_plat.py . [100%]
|
test_plat.py . [100%]
|
||||||
@@ -683,8 +686,9 @@ We can now use the ``-m option`` to select one set:
|
|||||||
|
|
||||||
$ pytest -m interface --tb=short
|
$ pytest -m interface --tb=short
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collected 4 items / 2 deselected / 2 selected
|
collected 4 items / 2 deselected / 2 selected
|
||||||
|
|
||||||
test_module.py FF [100%]
|
test_module.py FF [100%]
|
||||||
@@ -709,8 +713,9 @@ or to select both "event" and "interface" tests:
|
|||||||
|
|
||||||
$ pytest -m "interface or event" --tb=short
|
$ pytest -m "interface or event" --tb=short
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR
|
||||||
collected 4 items / 1 deselected / 3 selected
|
collected 4 items / 1 deselected / 3 selected
|
||||||
|
|
||||||
test_module.py FFF [100%]
|
test_module.py FFF [100%]
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ Working with non-python tests
|
|||||||
A basic example for specifying tests in Yaml files
|
A basic example for specifying tests in Yaml files
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
.. _`pytest-yamlwsgi`: https://pypi.org/project/pytest-yamlwsgi/
|
.. _`pytest-yamlwsgi`: http://bitbucket.org/aafshar/pytest-yamlwsgi/src/tip/pytest_yamlwsgi.py
|
||||||
|
.. _`PyYAML`: https://pypi.org/project/PyYAML/
|
||||||
|
|
||||||
Here is an example ``conftest.py`` (extracted from Ali Afshar's special purpose `pytest-yamlwsgi`_ plugin). This ``conftest.py`` will collect ``test*.yaml`` files and will execute the yaml-formatted content as custom tests:
|
Here is an example ``conftest.py`` (extracted from Ali Afshar's special purpose `pytest-yamlwsgi`_ plugin). This ``conftest.py`` will collect ``test*.yaml`` files and will execute the yaml-formatted content as custom tests:
|
||||||
|
|
||||||
@@ -21,15 +22,16 @@ You can create a simple example file:
|
|||||||
.. include:: nonpython/test_simple.yaml
|
.. include:: nonpython/test_simple.yaml
|
||||||
:literal:
|
:literal:
|
||||||
|
|
||||||
and if you installed :pypi:`PyYAML` or a compatible YAML-parser you can
|
and if you installed `PyYAML`_ or a compatible YAML-parser you can
|
||||||
now execute the test specification:
|
now execute the test specification:
|
||||||
|
|
||||||
.. code-block:: pytest
|
.. code-block:: pytest
|
||||||
|
|
||||||
nonpython $ pytest test_simple.yaml
|
nonpython $ pytest test_simple.yaml
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project/nonpython
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR/nonpython
|
||||||
collected 2 items
|
collected 2 items
|
||||||
|
|
||||||
test_simple.yaml F. [100%]
|
test_simple.yaml F. [100%]
|
||||||
@@ -64,9 +66,9 @@ consulted when reporting in ``verbose`` mode:
|
|||||||
|
|
||||||
nonpython $ pytest -v
|
nonpython $ pytest -v
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
|
||||||
cachedir: .pytest_cache
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: /home/sweet/project/nonpython
|
rootdir: $REGENDOC_TMPDIR/nonpython
|
||||||
collecting ... collected 2 items
|
collecting ... collected 2 items
|
||||||
|
|
||||||
test_simple.yaml::hello FAILED [ 50%]
|
test_simple.yaml::hello FAILED [ 50%]
|
||||||
@@ -90,8 +92,9 @@ interesting to just look at the collection tree:
|
|||||||
|
|
||||||
nonpython $ pytest --collect-only
|
nonpython $ pytest --collect-only
|
||||||
=========================== test session starts ============================
|
=========================== test session starts ============================
|
||||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y
|
||||||
rootdir: /home/sweet/project/nonpython
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
|
rootdir: $REGENDOC_TMPDIR/nonpython
|
||||||
collected 2 items
|
collected 2 items
|
||||||
|
|
||||||
<Package nonpython>
|
<Package nonpython>
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def pytest_collect_file(parent, file_path):
|
def pytest_collect_file(parent, fspath):
|
||||||
if file_path.suffix == ".yaml" and file_path.name.startswith("test"):
|
if fspath.suffix == ".yaml" and fspath.name.startswith("test"):
|
||||||
return YamlFile.from_parent(parent, path=file_path)
|
return YamlFile.from_parent(parent, path=fspath)
|
||||||
|
|
||||||
|
|
||||||
class YamlFile(pytest.File):
|
class YamlFile(pytest.File):
|
||||||
@@ -18,8 +18,8 @@ class YamlFile(pytest.File):
|
|||||||
|
|
||||||
|
|
||||||
class YamlItem(pytest.Item):
|
class YamlItem(pytest.Item):
|
||||||
def __init__(self, *, spec, **kwargs):
|
def __init__(self, name, parent, spec):
|
||||||
super().__init__(**kwargs)
|
super().__init__(name, parent)
|
||||||
self.spec = spec
|
self.spec = spec
|
||||||
|
|
||||||
def runtest(self):
|
def runtest(self):
|
||||||
@@ -40,7 +40,7 @@ class YamlItem(pytest.Item):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def reportinfo(self):
|
def reportinfo(self):
|
||||||
return self.path, 0, f"usecase: {self.name}"
|
return self.fspath, 0, f"usecase: {self.name}"
|
||||||
|
|
||||||
|
|
||||||
class YamlException(Exception):
|
class YamlException(Exception):
|
||||||
|
|||||||