Skip to content

Commit

Permalink
pytest - only error on warnings from within libqtile
Browse files Browse the repository at this point in the history
- Changes pytests warning filter (-W flag) to only error upon warnings
  that arise within libqtile. If they arise within our deps then we
  shouldn't error out.
- Moves the warning filter config from the command line (in tox.ini) to
  the configuration in setup.cfg
- re-instate warning filter for py310, which was temporarily disables
  due to an error in pygobject. It seems to only affect -W error
  globally on all warnings
- migrates pytest config from setup.cfg to pyproject.toml per their docs
  • Loading branch information
m-col committed Aug 4, 2023
1 parent 4d55ca3 commit c21452e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[tool.black]
line-length = 98
exclude = 'libqtile/_ffi.*\.py|libqtile/backend/x11/_ffi.*\.py|test/configs/syntaxerr.py'

[tool.pytest.ini_options]
python_files = "test_*.py"
testpaths = ["test"]
filterwarnings = [
"error:::libqtile",
]
5 changes: 0 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ ban-relative-imports = true
ignore = E203,W503,E704,E123,E226,E121,E24,E126,W504,N818,E501
enable-extensions = G

[tool:pytest]
python_files = test_*.py
testpaths = test
addopts = --verbose

[check-manifest]
ignore =
stubs**
Expand Down
6 changes: 2 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ commands =
pip install pywlroots>=0.16.1,<0.17.0
pip install --no-build-isolation .
{toxinidir}/scripts/ffibuild
# py310 currently fails with -W error, see: https://gitlab.gnome.org/GNOME/pygobject/-/issues/476
# pypy3 is very slow when running coverage reports so we skip it
pypy3: python3 -m pytest -W error --backend=x11 --backend=wayland {posargs}
py39: coverage run -m pytest -W error --backend=x11 --backend=wayland {posargs}
pypy3: python3 -m pytest --backend=x11 --backend=wayland {posargs}
py39: coverage run -m pytest --backend=x11 --backend=wayland {posargs}
py3{10,11}: coverage run -m pytest --backend=x11 --backend=wayland {posargs}

# Coverage runs tests in parallel so we need to combine results into a single file
Expand Down Expand Up @@ -114,7 +113,6 @@ commands =
# also run the tests that require mypy
pip install --no-build-isolation .
{toxinidir}/scripts/ffibuild
# py310 currently fails with -W error, see: https://gitlab.gnome.org/GNOME/pygobject/-/issues/476
python3 -m pytest -- test/test_check.py test/test_migrate.py

[testenv:docs]
Expand Down

0 comments on commit c21452e

Please sign in to comment.