From 40ce2e58ee5da7132c4599761aad0e179c95c842 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Tue, 5 Apr 2022 23:57:17 -0400 Subject: [PATCH] ci: Use PYTHONWARNINGS=error --- .github/workflows/ci.yml | 4 +++- tests/test_checks.py | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95bcc3c..42de834 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,9 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - run: pip install .[test] - - run: pytest --cov jscc --vcr-record=none tests + - env: + PYTHONWARNINGS: error + run: pytest --cov jscc --vcr-record=none tests - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: coveralls --service=github diff --git a/tests/test_checks.py b/tests/test_checks.py index d8ec71f..68a8c6a 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -1,6 +1,7 @@ import contextlib import json import os +import warnings import pytest from jsonref import JsonRef @@ -236,10 +237,11 @@ def allow_missing(pointer): def test_validate_ref_pass(): filepath = os.path.join('schema', 'schema.json') - with pytest.warns(None) as records: - errors = validate_ref(path(filepath), parse(filepath)) - assert errors == len(records) == 0 + with warnings.catch_warnings(): + warnings.simplefilter('error') + + errors = validate_ref(path(filepath), parse(filepath)) def test_validate_ref_fail():