Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure pytest to fail on warnings #3903

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/contrib_rerun_py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:

- name: Run unit tests
shell: bash
run: cd rerun_py/tests && pytest
run: cd rerun_py/tests && pytest -c ../pyproject.toml

- name: Run e2e test
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_build_and_test_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ jobs:
- name: Run unit tests
if: needs.set-config.outputs.RUN_TESTS == 'true'
shell: bash
run: cd rerun_py/tests && pytest
run: cd rerun_py/tests && pytest -c ../pyproject.toml

- name: Run e2e test
if: needs.set-config.outputs.RUN_TESTS == 'true'
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ py-lint:

# Run fast unittests
py-test:
python -m pytest -vv rerun_py/tests/unit/
python -m pytest -vv -c rerun_py/pyproject.toml rerun_py/tests/unit/

# Run tests on all supported Python versions (through nox)
py-test-allpy:
Expand Down
7 changes: 7 additions & 0 deletions rerun_py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,10 @@ include = ["rerun_sdk.pth", "rerun_sdk/rerun_demo/colmap_fiat.rrd"]
locked = true
name = "rerun_bindings" # name of the .so library that the Python module will import
python-packages = ["rerun_sdk/rerun", "rerun_sdk/rerun_demo"]

[tool.pytest.ini_options]
# These conform to Python's Warning Filter syntax:
# https://docs.python.org/3/library/warnings.html#warning-filter
filterwarnings = """
error
"""
4 changes: 2 additions & 2 deletions rerun_py/rerun_sdk/rerun/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def __init__(
if (path is None) == (contents is None):
raise ValueError("Must provide exactly one of 'path' or 'contents'")

buffer: IO[bytes] | None = None
buffer: IO[bytes] | None
if path is not None:
buffer = open(path, "rb")
buffer = io.BytesIO(pathlib.Path(path).read_bytes())
elif isinstance(contents, bytes):
buffer = io.BytesIO(contents)
else:
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/archetypes/asset3d_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(
if path is None:
blob = contents
else:
blob = open(path, "rb").read()
blob = pathlib.Path(path).read_bytes()
if media_type is None:
media_type = guess_media_type(str(path))

Expand Down
Loading