Skip to content

Commit 33eef6a

Browse files
committed
TST: stricter warning checks
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 81be0ad commit 33eef6a

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,7 @@ addopts = ['-ra', '--strict-markers', '--strict-config']
8383
log_cli_level = 'info'
8484
norecursedirs = 'tests/packages/*'
8585
testpaths = ['tests']
86+
xfail_strict = true
87+
filterwarnings = [
88+
'error',
89+
]

tests/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import subprocess
1010
import sys
1111
import tempfile
12+
import warnings
1213

1314
from venv import EnvBuilder
1415

@@ -71,7 +72,12 @@ def tmp_dir_session(tmpdir_factory):
7172
class VEnv(EnvBuilder):
7273
def __init__(self, env_dir):
7374
super().__init__(with_pip=True)
74-
self.create(env_dir)
75+
# This warning is mistakenly generated by CPython 3.11.0
76+
# https://github.com/python/cpython/pull/98743
77+
with warnings.catch_warnings():
78+
if sys.version_info[:3] == (3, 11, 0):
79+
warnings.filterwarnings('ignore', 'check_home argument is deprecated and ignored.', DeprecationWarning)
80+
self.create(env_dir)
7581

7682
def ensure_directories(self, env_dir):
7783
context = super().ensure_directories(env_dir)

tests/test_wheelfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
def test_basic(tmp_path):
99
path = tmp_path / 'test-1.0-py3-any-none.whl'
1010
bar = tmp_path / 'bar'
11-
open(bar, 'wb').write(b'bar')
11+
bar.write_bytes(b'bar')
1212
with mesonpy._wheelfile.WheelFile(path, 'w') as w:
1313
assert w.name == 'test'
1414
assert w.version == '1.0'
@@ -27,7 +27,7 @@ def test_source_date_epoch(tmp_path, monkeypatch):
2727
assert epoch % 2 == 0
2828
monkeypatch.setenv('SOURCE_DATE_EPOCH', str(epoch))
2929
bar = tmp_path / 'bar'
30-
open(bar, 'wb').write(b'bar')
30+
bar.write_bytes(b'bar')
3131
with mesonpy._wheelfile.WheelFile(path, 'w') as w:
3232
w.writestr('foo', b'test')
3333
w.write(bar, 'bar')

0 commit comments

Comments
 (0)