From bd4dfb4729377bf64c552ef6052095aa0b5658b8 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Wed, 24 Aug 2022 14:31:40 -0700 Subject: chore: Only check for our UserWarning The GitHub CI is showing a ResourceWarning, causing our test to fail. Update test to only look for our UserWarning which should not appear. What was seen when debugging the GitHub CI: {message: ResourceWarning( "unclosed " ), category: 'ResourceWarning', filename: '/home/runner/work/python-gitlab/python-gitlab/.tox/api_func_v4/lib/python3.10/site-packages/urllib3/poolmanager.py', lineno: 271, line: None } --- tests/functional/api/test_gitlab.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/functional/api/test_gitlab.py') diff --git a/tests/functional/api/test_gitlab.py b/tests/functional/api/test_gitlab.py index 8e62210..f2bdf50 100644 --- a/tests/functional/api/test_gitlab.py +++ b/tests/functional/api/test_gitlab.py @@ -240,7 +240,11 @@ def test_list_all_false_nowarning(gl, recwarn): def test_list_all_true_nowarning(gl, get_all_kwargs, recwarn): """Using `get_all=True` will disable the warning""" items = gl.gitlabciymls.list(**get_all_kwargs) - assert not recwarn + for warn in recwarn: + if issubclass(warn.category, UserWarning): + # Our warning has a link to the docs in it, make sure we don't have + # that. + assert "python-gitlab.readthedocs.io" not in str(warn.message) assert len(items) > 20 -- cgit v1.2.1