From 8951b11fead29aa2abbe1c6a15b89887b1ffe92b Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 31 Jan 2026 00:08:31 -0800 Subject: [PATCH 1/3] Change Pillow `Image.getdata()` to `Image.get_flattened_data()` Pillow DeprecationWarning: Image.Image.getdata is deprecated and will be removed in Pillow 14 (2027-10-15). Use get_flattened_data instead. --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 9dfde0b29..81b99252e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -450,7 +450,7 @@ def detect_color_image(file, thumb_size=150, MSE_cutoff=22, adjust_color_bias=Tr if adjust_color_bias: bias = ImageStat.Stat(thumb).mean[:3] bias = [b - sum(bias) / 3 for b in bias] - for pixel in thumb.getdata(): + for pixel in thumb.get_flattened_data(): mu = sum(pixel) / 3 sse += sum( (pixel[i] - mu - bias[i]) * (pixel[i] - mu - bias[i]) for i in [0, 1, 2] From 751256e94c69fa7e71bc60e1ba949547c10367d7 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 31 Jan 2026 00:08:51 -0800 Subject: [PATCH 2/3] Mark Movie on-demand subtitle test as xfail --- tests/test_video.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_video.py b/tests/test_video.py index 410d96d3a..24fdac8de 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -442,6 +442,7 @@ def test_video_Movie_upload_select_remove_subtitle(movie, subtitle): pass +@pytest.mark.xfail(reason="Plex's OpenSubtitles times out occasionally") def test_video_Movie_on_demand_subtitles(movie, account): movie_subtitles = movie.subtitleStreams() subtitles = movie.searchSubtitles() From 95d04e004edb98b72908e471927ae89c769d051b Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 13 Feb 2026 18:37:13 -0800 Subject: [PATCH 3/3] Fix JWT login test plex.tv/devices.xml no longer returns the device token Ref.: https://forums.plex.tv/t/information-related-to-security-vulnerabilities/935164/17 --- tests/test_myplex.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/test_myplex.py b/tests/test_myplex.py index 7dc15e414..6059251ba 100644 --- a/tests/test_myplex.py +++ b/tests/test_myplex.py @@ -2,8 +2,8 @@ import pytest from plexapi.exceptions import BadRequest, NotFound, Unauthorized -from plexapi.myplex import MyPlexAccount, MyPlexInvite, MyPlexJWTLogin -from plexapi.utils import createMyPlexDevice +from plexapi.myplex import MyPlexAccount, MyPlexInvite, MyPlexPinLogin, MyPlexJWTLogin +from plexapi.utils import generateUUID from . import conftest as utils from .payloads import MYPLEX_INVITE @@ -371,14 +371,19 @@ def test_myplex_ping(account): def test_myplex_jwt_login(account, tmp_path, monkeypatch): # Create a new MyPlexDevice for JWT tests - device = createMyPlexDevice(account=account) + clientIdentifier = generateUUID() + headers = {'X-Plex-Client-Identifier': clientIdentifier} + pinlogin = MyPlexPinLogin(headers=headers) + pinlogin.run() + account.link(pinlogin.pin) + pinlogin.waitForLogin() privkey = tmp_path / 'private.key' pubkey = tmp_path / 'public.key' jwtlogin = MyPlexJWTLogin( - headers={'X-Plex-Client-Identifier': device.clientIdentifier}, - token=device.token, + headers=headers, + token=pinlogin.token, scopes=['username', 'email', 'friendly_name'] ) jwtlogin.generateKeypair(keyfiles=(privkey, pubkey), overwrite=True) @@ -391,7 +396,7 @@ def test_myplex_jwt_login(account, tmp_path, monkeypatch): assert new_account.username == account.username jwtlogin = MyPlexJWTLogin( - headers={'X-Plex-Client-Identifier': device.clientIdentifier}, + headers=headers, jwtToken=jwtToken, keypair=(privkey, pubkey), scopes=['username', 'email', 'friendly_name'] @@ -411,4 +416,4 @@ def test_myplex_jwt_login(account, tmp_path, monkeypatch): with pytest.raises(jwt.InvalidSignatureError): jwtlogin.decodePlexJWT() - device.delete() + account.device(clientId=clientIdentifier).delete()