Skip to content

Commit bd4dfb4

Browse files
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 <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 50862), raddr=('127.0.0.1', 8080)>" ), 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 }
1 parent 98f1956 commit bd4dfb4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/functional/api/test_gitlab.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ def test_list_all_false_nowarning(gl, recwarn):
240240
def test_list_all_true_nowarning(gl, get_all_kwargs, recwarn):
241241
"""Using `get_all=True` will disable the warning"""
242242
items = gl.gitlabciymls.list(**get_all_kwargs)
243-
assert not recwarn
243+
for warn in recwarn:
244+
if issubclass(warn.category, UserWarning):
245+
# Our warning has a link to the docs in it, make sure we don't have
246+
# that.
247+
assert "python-gitlab.readthedocs.io" not in str(warn.message)
244248
assert len(items) > 20
245249

246250

0 commit comments

Comments
 (0)