Skip to content

Dynamic Scopes Documentation Needs Fixing #6783

@TWood67

Description

@TWood67

When using

if config.getoption("--keep-containers"):

and keep-containers does not exist, an exception is thrown. This results in a misleading type error from:
https://github.com/pytest-dev/pytest/blob/master/src/_pytest/fixtures.py#L813-L814
Documentation should be updated to show usage providing a default value:

if config.getoption("--keep-containers", None):
Package             Version
------------------- -------
appdirs             1.4.3  
attrs               19.3.0 
Click               7.0    
distlib             0.3.0  
filelock            3.0.12 
Flask               1.1.1  
importlib-metadata  1.5.0  
importlib-resources 1.0.2  
itsdangerous        1.1.0  
Jinja2              2.11.1 
MarkupSafe          1.1.1  
more-itertools      8.2.0  
packaging           20.1   
pip                 20.0.2 
pluggy              0.13.1 
py                  1.8.1  
pyparsing           2.4.6  
pytest              5.3.5  
setuptools          45.2.0 
six                 1.14.0 
toml                0.10.0 
tox                 3.14.5 
virtualenv          20.0.4 
wcwidth             0.1.8  
Werkzeug            1.0.0  
wheel               0.34.2 
zipp                3.0.0 
bash-3.2$ pytest --version
This is pytest version 5.3.5
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G3020

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: configrelated to config handling, argument parsing and config filetype: docsdocumentation improvement, missing or needing clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions