Skip to content

Commit

Permalink
fix(dev): Patch firefox_profile.py from Selenium package (#29887)
Browse files Browse the repository at this point in the history
Running `pytest` in `getsentry` triggers a bug in `firefox_profile.py` from the Selenium driver. Upgrading to version 4 is quite involved. This is a stop-gap to prevent distracting engineers when it happens.
  • Loading branch information
armenzg authored Nov 15, 2021
1 parent 75aee25 commit 8fbfd49
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ phabricator==0.7.0

# test dependencies, but unable to move to requirements-test until
# sentry.utils.pytest and sentry.testutils are moved to tests/
selenium==3.141.0
selenium==3.141.0 # When upgrading, remove hack from lib.sh (see https://github.com/getsentry/sentry/pull/29887 for details)
sqlparse==0.2.4
7 changes: 7 additions & 0 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ install-py-dev() {
# https://github.com/unbit/uwsgi/issues/2361
pip install https://storage.googleapis.com/python-arm64-wheels/uWSGI-2.0.19.1-cp38-cp38-macosx_11_0_universal2.whl
fi
# This hack is until we can upgrade to a newer version of Selenium
fx_profile=.venv/lib/python3.8/site-packages/selenium/webdriver/firefox/firefox_profile.py
# Remove this block when upgrading the selenium package
if grep -q "or setting is" "${fx_profile}"; then
echo "We are patching ${fx_profile}. You will see this message only once."
patch -p0 <scripts/patches/firefox_profile.diff
fi
# SENTRY_LIGHT_BUILD=1 disables webpacking during setup.py.
# Webpacked assets are only necessary for devserver (which does it lazily anyways)
# and acceptance tests, which webpack automatically if run.
Expand Down
7 changes: 7 additions & 0 deletions scripts/patches/firefox_profile.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--- .venv/lib/python3.8/site-packages/selenium/webdriver/firefox/firefox_profile.py 2021-11-09 16:40:20.000000000 -0500
+++ .venv/lib/python3.8/site-packages/selenium/webdriver/firefox/firefox_profile.py.bak 2021-11-09 16:40:03.000000000 -0500
@@ -207,3 +207,3 @@
def _set_manual_proxy_preference(self, key, setting):
- if setting is None or setting is '':
+ if setting is None or setting == '':
return

0 comments on commit 8fbfd49

Please sign in to comment.