Skip to content

PytestConfigWarning for log_print, flake8-ignore, flake8-max-line-length #7612

@marincandenza

Description

@marincandenza

Executing our tests with PyTest 6.1 on Windows leads to PytestConfigWarning when parsing pytest.ini
Installed packages and pytest.ini is attached.

Thank you for providing powerful PyTest!

============================== warnings summary ===============================
venv\lib\site-packages\_pytest\config\__init__.py:1148
  C:\work\VV\vv-common\venv\lib\site-packages\_pytest\config\__init__.py:1148: PytestConfigWarning: Unknown config ini key: flake8-ignore
  
    self._warn_or_fail_if_strict("Unknown config ini key: {}\n".format(key))

venv\lib\site-packages\_pytest\config\__init__.py:1148
  C:\work\VV\vv-common\venv\lib\site-packages\_pytest\config\__init__.py:1148: PytestConfigWarning: Unknown config ini key: flake8-max-line-length
  
    self._warn_or_fail_if_strict("Unknown config ini key: {}\n".format(key))

venv\lib\site-packages\_pytest\config\__init__.py:1148
  C:\work\VV\vv-common\venv\lib\site-packages\_pytest\config\__init__.py:1148: PytestConfigWarning: Unknown config ini key: log_print
  
    self._warn_or_fail_if_strict("Unknown config ini key: {}\n".format(key))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================== 1 passed, 3 warnings in 0.08s ========================

Process finished with exit code 0
(venv) C:\work>pip list
Package          Version
---------------- ---------
apipkg           1.5
atomicwrites     1.4.0
attrs            19.3.0
bcrypt           3.1.7
Cerberus         1.3.2
certifi          2020.6.20
cffi             1.14.1
chardet          3.0.4
colorama         0.4.3
crcmod           1.7
cryptography     3.0
execnet          1.7.1
idna             2.10
iniconfig        1.0.1
more-itertools   8.4.0
msgpack          1.0.0
numpy            1.19.1
packaging        20.4
paramiko         2.7.1
pip              19.2.3
pluggy           0.13.1
psutil           5.7.2
py               1.9.0
pycparser        2.20
PyNaCl           1.4.0
pyparsing        2.4.7
pyserial         3.4
pysftp           0.2.9
pytest           6.0.1
pytest-forked    1.3.0
pytest-html      2.1.1
pytest-metadata  1.10.0
pytest-variables 1.9.0
pytest-xdist     1.34.0
pythonping       1.0.10
PyVISA           1.10.1
PyVISA-py        0.4.1
PyYAML           5.3.1
requests         2.24.0
setuptools       41.2.0
setuptools-scm   4.1.2
six              1.15.0
testinfra        5.2.2
toml             0.10.1
urllib3          1.25.10
websocket-client 0.57.0
wheel            0.34.2
**pytest.ini**
[pytest]
norecursedirs = .eggs* build* .git* _build* tmp* dist* pytest_sick.egg-info* logs* venv*
yaml_loader = FullLoader
;addopts= --variables=config/04_emulator.yaml --junit-xml logs/junit.xml
addopts= --self-contained-html --tb=short
#--variables=config/04_emulator.yaml

markers =
    square: square tests (deselect with '-m "not slow"')
    others: other tests


;addopts = -n3                                  ; Run in three threads
;tb=short            ; [auto, long, short, line, native, no]: http://doc.pytest.org/en/latest/usage.html#modifying-python-traceback-printing

;Configures how durations are recorded into the JUnit XML report:
;total (the default): duration times reported include setup, call, and teardown times.
;call: duration times reported include only call times, excluding setup and teardown.
junit_duration_report = total

;Configures the format of the generated JUnit XML file. The possible options are:
;xunit1 (or legacy): produces old style output, compatible with the xunit 1.0 format. This is the default.
;xunit2: produces xunit 2.0 style output,
;which should be more compatible with latest Jenkins versions.
junit_family = xunit2

;Configures if stdout/stderr should be written to the JUnit XML file.
;Valid values are system-out, system-err, and no (the default).
junit_logging = system-out

;If junit_logging != "no", configures if the captured output should be written to the JUnit XML file for passing tests.
;Default is True.
junit_log_passing_tests = true

;To set the name of the root test suite xml item, you can configure the junit_suite_name option in your config file:
junit_suite_name = vv_common

;Sets the minimum log message level that should be captured for live logging.
;The integer value or the names of the levels can be used.
log_level = 9

;By setting the log_cli configuration option to true,
;pytest will output logging records as they are emitted directly into the console.
log_cli = true

;Sets the minimum log message level that should be captured for live logging.
;The integer value or the names of the levels can be used.
log_cli_level = 9

;Sets a time.strftime()-compatible string that will be used when formatting dates for live logging.
log_cli_date_format = %Y-%m-%d %H:%M:%S

;Sets a logging-compatible string used to format live logging messages.
log_cli_format = %(asctime)s.%(msecs)03d %(levelname)s %(name)s ==>> <<%(message)s>>

;Sets a logging-compatible string used to format logging messages redirected to the logging file.
log_file_format = %(asctime)s.%(msecs)03d %(levelname)s %(name)s ==>> <<%(message)s>>

;Sets the minimum log message level that should be captured for the logging file.
;The integer value or the names of the levels can be used.
log_file_level = 9

;Sets a file name relative to the pytest.ini file where log messages should be written to,
; in addition to the other logging facilities that are active.
;log_file=logs/pytest-logs.txt

;Sets a time.strftime()-compatible string that will be used when formatting dates for logging capture.
log_date_format = %Y-%m-%d %H:%M:%S

;Sets a time.strftime()-compatible string that will be used when formatting dates for the logging file.
log_file_date_format = %Y-%m-%d %H:%M:%S

;Sets a logging-compatible string used to format captured logging messages.
log_format = %(asctime)s.%(msecs)03d %(levelname)s %(name)s ==>> <<%(message)s>>

;If set to False, will disable displaying captured logging messages for failed tests.
log_print = True

; flake8 settings
flake8-max-line-length = 120
; Ignore settings for flake8
;E121=Continuation line under-indented for hanging indent -> sometimes its Black
;E501=Line too long -> excluded for generated code
;F405='object' may be undefined, or defined from star imports -> star import from generated code
;W291=trailing whitespace
;W293=blank line contains whitespace
;W391=Empty line at end of file
;W503=Line break before binary operator -> Black
flake8-ignore = crowns/*/*.py E501 F405 W291 W293
                cids/*/*.py E501 F405 W291 W293
                test_stubs/*/*.py E501 F405 W293
                W391
                E203    # black
                W503    # black
                doc/conf.py ALL

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questiongeneral question, might be closed after 2 weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions