Skip to content

Commit

Permalink
build, test: upgrade to vcrpy>=5 & refresh broken cassettes
Browse files Browse the repository at this point in the history
This is *probably* the ideal solution to my issues with certain VCR
cassettes failing locally, since we were on vcrpy 2.x for quite a long
time. Skipping two whole major versions probably isn't ideal, but I like
this solution because:

* No more pinning urllib3 at runtime to make a dev requirement happy
* No more snarky incompatibility warning from pip that types-requests
  wants urllib3 2.x but we have 1.x (seen in CI logs)
* No more weird BrotliDecoderDecompressStream exceptions in my local
  environment (which didn't happen in CI)

Note that this commit only updates half a dozen YAML cassettes for two
plugins whose tests *failed* after upgrading vcrpy. Working cassettes
have been left untouched.

vcrpy 5 is currently installed from a fork that removes the upstream
version cap on urllib3<2 for Python < 3.10, as it seems cassettes are
often incompatible across major urllib3 versions. (Cassettes that would
work when tests ran under urllib3 1.x raised exceptions under urllib3
2.x, and vice versa.)

Upstream, the vcrpy maintainers have been totally silent since I opened
a pull request suggesting the removal of this version cap. After two
weeks without any acknowledgement whatsoever, I chose to create a fork
within Sopel's GitHub organization specifically for use with our CI and
dev-environment setup.

This should be more or less fine, since only CI and maintainers are
likely to bother installing the dev-requirements. Packaged releases
don't include them, so we can move pretty quickly to get current again
whenever the vcrpy maintainers accept the change (or if they do).

The "internal" fork also guards against deleting my personal fork. (When
a patch I submitted is merged, I habitually delete my fork if I don't
foresee making further contributions to that project.)
  • Loading branch information
dgw committed Oct 30, 2023
1 parent 4c7b507 commit 3288fe7
Show file tree
Hide file tree
Showing 8 changed files with 2,661 additions and 1,666 deletions.
4 changes: 3 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ sphinx>=4,<5
sphinxcontrib-autoprogram==0.1.8
# custom plugin to help with RFC links
sphinx-rfcsection~=0.1.1
vcrpy<3.0.0
# use fork of vcrpy 5.x until kevin1024/vcrpy#777 is (hopefully) accepted
# (or until py3.9 EOL... in 10/2025, I HOPE NOT)
vcrpy @ git+https://github.com/sopel-irc/vcrpy@uncap-urllib3
# type check
mypy>=1.3,<2
sqlalchemy[mypy]>=1.4,<1.5
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ dependencies = [
"pytz",
"geoip2>=4.0,<5.0",
"requests>=2.24.0,<3.0.0",
"urllib3<2.0", # TODO: unpin when vcrpy etc. will tolerate it
"dnspython<3.0",
"sqlalchemy>=1.4,<1.5",
"importlib_metadata>=3.6",
Expand Down
920 changes: 695 additions & 225 deletions test/vcr/modules/search/test_example_duck_0.yaml

Large diffs are not rendered by default.

936 changes: 742 additions & 194 deletions test/vcr/modules/search/test_example_duck_1.yaml

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions test/vcr/modules/search/test_example_suggest_0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ interactions:
uri: https://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=lkashdfiauwgaef
response:
body:
string: !!binary |
H4sIAAAAAAAC/7Oxr8jNUShLLSrOzM+zVTLUM1Cyt7MpyS/ISS1LzbGz0YczAYEc0EoqAAAA
string: <?xml version="1.0"?><toplevel></toplevel>
headers:
Alt-Svc:
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Expand All @@ -24,24 +23,24 @@ interactions:
Content-Encoding:
- gzip
Content-Security-Policy:
- 'object-src ''none'';base-uri ''self'';script-src ''nonce-bqn-bde_sURx7gg6smeyow''
- 'object-src ''none'';base-uri ''self'';script-src ''nonce-yoXc9HzWTdGO9RKE1Acudw''
''strict-dynamic'' ''report-sample'' ''unsafe-eval'' ''unsafe-inline'' https:
http:;report-uri https://csp.withgoogle.com/csp/gws/xsrp'
Content-Type:
- text/xml; charset=ISO-8859-1
Date:
- Sun, 01 Oct 2023 22:08:12 GMT
- Thu, 12 Oct 2023 04:39:29 GMT
Expires:
- Sun, 01 Oct 2023 22:08:12 GMT
- Thu, 12 Oct 2023 04:39:29 GMT
P3P:
- CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server:
- gws
Set-Cookie:
- 1P_JAR=2023-10-01-22; expires=Tue, 31-Oct-2023 22:08:12 GMT; path=/; domain=.google.com;
- 1P_JAR=2023-10-12-04; expires=Sat, 11-Nov-2023 04:39:29 GMT; path=/; domain=.google.com;
Secure
- NID=511=dO-EpOs4FOklsnc4Pp3npRl1SVjfpgKMbw8to-Rx9usNNf_zbI02DRK-uIdRBYYvAVDOdu_zksAU1aRpNDsefpbsuAf54C2fz4RMgIrUH5i-MEnJ5kFBbrq-d8Of2g-Cp2BZDB0-_XyI1WT5VWdwpNprOyrNJVs4wtfLPxPe_DQ;
expires=Mon, 01-Apr-2024 22:08:12 GMT; path=/; domain=.google.com; HttpOnly
- NID=511=EDlXqJw8GIVnkknq9WCPq-iS6jGJAaE5aoJrBdn0MHgUw7s7fedPgPYNqkijDLggXLwIN3ZrcyvQZ-BZZmepycsJ0Ye-oy6T5G3zUtJgUAvym_DfBst5Ug8waBXcvNyVg5v4U5TAW9QyzUW35i6NZ3f9kpNOksKFlUT5UAXiVS4;
expires=Fri, 12-Apr-2024 04:39:29 GMT; path=/; domain=.google.com; HttpOnly
Transfer-Encoding:
- chunked
X-Frame-Options:
Expand Down
26 changes: 16 additions & 10 deletions test/vcr/modules/search/test_example_suggest_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ interactions:
uri: https://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=wikip
response:
body:
string: !!binary |
H4sIAAAAAAAC/63TPQrDMAwF4KsYH6Bpd8cZeoSeQMQPR8R/2E6a4zdTpnYoaHuD9METyExHDGpH
bZzTqB+3u56s6bkE7AjWPHM8Y8dr8x6tn0PWtCsrR51G/eaVCxyTHqwZvq38x6gGqvMipSH5wE2M
8xQhVrQArm5J9nCKk3TpXArSAo6oUqSjuqqYndgxKyWXo6LaeQ7C6k9tuH7lA1+7OeZLAwAA
string: <?xml version="1.0"?><toplevel><CompleteSuggestion><suggestion data="wikipedia"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia search"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia game"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia israel"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia speedrun"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia search in english"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia palestine"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia oppenheimer"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia dark mode"/></CompleteSuggestion><CompleteSuggestion><suggestion
data="wikipedia gaza strip"/></CompleteSuggestion></toplevel>
headers:
Alt-Svc:
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Expand All @@ -26,24 +32,24 @@ interactions:
Content-Encoding:
- gzip
Content-Security-Policy:
- 'object-src ''none'';base-uri ''self'';script-src ''nonce-tweQn7Ss8hox9zQe-xYVHA''
- 'object-src ''none'';base-uri ''self'';script-src ''nonce-ZhhjlE3AKG1y99DS-lRDMw''
''strict-dynamic'' ''report-sample'' ''unsafe-eval'' ''unsafe-inline'' https:
http:;report-uri https://csp.withgoogle.com/csp/gws/xsrp'
Content-Type:
- text/xml; charset=ISO-8859-1
Date:
- Sun, 01 Oct 2023 22:08:12 GMT
- Thu, 12 Oct 2023 04:39:29 GMT
Expires:
- Sun, 01 Oct 2023 22:08:12 GMT
- Thu, 12 Oct 2023 04:39:29 GMT
P3P:
- CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server:
- gws
Set-Cookie:
- 1P_JAR=2023-10-01-22; expires=Tue, 31-Oct-2023 22:08:12 GMT; path=/; domain=.google.com;
- 1P_JAR=2023-10-12-04; expires=Sat, 11-Nov-2023 04:39:29 GMT; path=/; domain=.google.com;
Secure
- NID=511=GKP1S5d2fEPy67A69aYS0ZwYbNd_e7leYIAx6IRB4HxNWKE6YG-6ydKKf73w7khkbQ_LvVsrCodezyg_WiNpixCKw22_O0v3YtaiBlEGJ5tjKg7xQgW2wdGhVXo_svbIoz-SXgCyIsf-iMIGrKeUYQzTybvG5Jpc3PmvYcn62VQ;
expires=Mon, 01-Apr-2024 22:08:12 GMT; path=/; domain=.google.com; HttpOnly
- NID=511=UgsnerPc1dI5PMohIss-UiIUw3x_rOLP_sxO8gmZkuxyrpa7Iq4m4wDK4tZTWT4kMBMS6euma3kFUB2Tl9jrSdHulPrzoTgK0yZG_r_gr8uemYmNhndNcEn18gvCN89m8k7EnYapDx5P9Sbxr5ufxR2ruXS-OmU6iqu0p88oPqM;
expires=Fri, 12-Apr-2024 04:39:29 GMT; path=/; domain=.google.com; HttpOnly
Transfer-Encoding:
- chunked
X-Frame-Options:
Expand Down
17 changes: 8 additions & 9 deletions test/vcr/modules/search/test_example_suggest_2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ interactions:
uri: https://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=sopel+irc
response:
body:
string: !!binary |
H4sIAAAAAAAC/7Oxr8jNUShLLSrOzM+zVTLUM1Cyt7MpyS/ISS1LzbGzcc7PBTJLUoNL09NTi0uA
iuxsiuFshZTEkkRbpeL8gtQchcyiZCV9Oxt9bFr04SYCAKTyHI5xAAAA
string: <?xml version="1.0"?><toplevel><CompleteSuggestion><suggestion data="sopel
irc"/></CompleteSuggestion></toplevel>
headers:
Alt-Svc:
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Expand All @@ -25,24 +24,24 @@ interactions:
Content-Encoding:
- gzip
Content-Security-Policy:
- 'object-src ''none'';base-uri ''self'';script-src ''nonce-0QjS0PS1bkaLNV-ZwUrXtw''
- 'object-src ''none'';base-uri ''self'';script-src ''nonce-ZNUDAmWQ5jWHwsBTLOrGXw''
''strict-dynamic'' ''report-sample'' ''unsafe-eval'' ''unsafe-inline'' https:
http:;report-uri https://csp.withgoogle.com/csp/gws/xsrp'
Content-Type:
- text/xml; charset=ISO-8859-1
Date:
- Sun, 01 Oct 2023 22:08:13 GMT
- Thu, 12 Oct 2023 04:39:29 GMT
Expires:
- Sun, 01 Oct 2023 22:08:13 GMT
- Thu, 12 Oct 2023 04:39:29 GMT
P3P:
- CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server:
- gws
Set-Cookie:
- 1P_JAR=2023-10-01-22; expires=Tue, 31-Oct-2023 22:08:13 GMT; path=/; domain=.google.com;
- 1P_JAR=2023-10-12-04; expires=Sat, 11-Nov-2023 04:39:29 GMT; path=/; domain=.google.com;
Secure
- NID=511=R9yxS4Vqfw-TpuqZFOmLmSnTAI9dE_3a_3kI-t4dINKpdeJb12NLhoIAA9S5O8uE1Lz1Qj00FYzA1bVuMEASytLNDl920QJDA8u7Yp-YiskoGG9T0FRMK4-QzMSAy4gBwmY-e2MT_5uYFM_FgFY7EoaeWpo6hotXXbbopRdg9Co;
expires=Mon, 01-Apr-2024 22:08:13 GMT; path=/; domain=.google.com; HttpOnly
- NID=511=jlELNMjRfk79a0trEFcZFKHypFdBzv4AODS-ttpnXttvig8APhjENyAlXfiSGgicvm8DNjxoBW4NUAah5Ubw2ABcODT5w5UgXvTTXOpMrJEtQFtmviJvJe_wlbVH3T87PNdX46acUC91aS9_N12SMm_hznR9VBVazAYv4JRpPUg;
expires=Fri, 12-Apr-2024 04:39:29 GMT; path=/; domain=.google.com; HttpOnly
Transfer-Encoding:
- chunked
X-Frame-Options:
Expand Down
Loading

0 comments on commit 3288fe7

Please sign in to comment.