diff options
| author | John L. Villalovos <john@sodarock.com> | 2022-08-24 14:31:40 -0700 |
|---|---|---|
| committer | John L. Villalovos <john@sodarock.com> | 2022-08-24 14:31:40 -0700 |
| commit | bd4dfb4729377bf64c552ef6052095aa0b5658b8 (patch) | |
| tree | 953ed8598862d6b4705f6e491e7fd5e8399acec4 | |
| parent | 98f19564c2a9feb108845d33bf3631fa219e51c6 (diff) | |
| download | gitlab-bd4dfb4729377bf64c552ef6052095aa0b5658b8.tar.gz | |
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
}
| -rw-r--r-- | tests/functional/api/test_gitlab.py | 6 |
1 files changed, 5 insertions, 1 deletions
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 |
