Skip to content

Commit

Permalink
Merge branch 'main' into whatsapp-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Nov 20, 2023
2 parents 3433782 + 6b14039 commit 9bf7daf
Show file tree
Hide file tree
Showing 13 changed files with 188 additions and 223 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ jobs:
if: ${{ matrix.os == 'macos-latest' }}
- name: Checkout code
uses: actions/checkout@v3
- name: Install Firefox (for browser testing)
uses: browser-actions/setup-firefox@latest
- name: Install Geckodriver (for browser testing)
uses: browser-actions/setup-geckodriver@latest
- name: Install Chrome (for browser testing)
uses: browser-actions/setup-chrome@latest
- name: Install Chromedriver (for browser testing)
uses: nanasess/setup-chromedriver@v2
- name: Install Python
uses: actions/setup-python@v4
with:
Expand All @@ -78,6 +78,8 @@ jobs:
key: ${{ matrix.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements.txt/test.txt') }}
- name: Install Python dependencies
run: make install-python-test
- name: Install Playwright browser
run: make install-playwright
- name: Install Node
uses: actions/setup-node@v3
with:
Expand Down
11 changes: 4 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ repos:
'PYSEC-2022-42969', # https://github.com/pytest-dev/pytest/issues/10392
'--ignore-vuln',
'PYSEC-2023-73', # https://github.com/RedisLabs/redisraft/issues/608
'--ignore-vuln',
'PYSEC-2023-101', # https://github.com/pytest-dev/pytest-selenium/issues/310
'--ignore-vuln',
'PYSEC-2023-206', # pytest-selenium again
]
files: ^requirements/.*\.txt$
- repo: https://github.com/asottile/pyupgrade
Expand All @@ -55,7 +51,7 @@ repos:
- id: pyupgrade
args: ['--keep-runtime-typing', '--py311-plus']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
rev: v0.1.5
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
Expand Down Expand Up @@ -101,7 +97,7 @@ repos:
additional_dependencies:
- tomli
- repo: https://github.com/psf/black
rev: 23.10.1
rev: 23.11.0
hooks:
- id: black
# Mypy is temporarily disabled until the SQLAlchemy 2.0 migration is complete
Expand Down Expand Up @@ -161,6 +157,7 @@ repos:
- --deps-file=requirements/base.in
- --exclude-dep=argon2-cffi # Optional dep for passlib
- --exclude-dep=bcrypt # Optional dep for passlib
- --exclude-dep=greenlet # Optional dep for SQLAlchemy's asyncio support
- --exclude-dep=gunicorn # Not imported, used as server
- --exclude-dep=linkify-it-py # Optional dep for markdown-it-py
- --exclude-dep=psycopg # Optional dep for SQLAlchemy
Expand Down Expand Up @@ -211,7 +208,7 @@ repos:
- id: forbid-tabs
- id: remove-tabs
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.1.0
hooks:
- id: prettier
args:
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ all:
@echo
@echo "For testing and CI:"
@echo " make install-test # Install everything needed for a test environment"
@echo " make install-playwright # Install browsers for Playwright-based tests"
@echo
@echo "For development:"
@echo " make install-dev # For first time setup and after dependency upgrades"
Expand Down Expand Up @@ -118,9 +119,18 @@ install-python-test: install-python-pip deps-editable
install-python: install-python-pip deps-editable
pip install --use-pep517 -r requirements/base.txt

install-dev: deps-editable install-python-dev install-npm assets
install-playwright:
@if command -v playwright > /dev/null; then\
echo "playwright install --with-deps";\
playwright install --with-deps;\
else\
echo "Install Playwright first: make install-python-test";\
exit 1;\
fi

install-test: deps-editable install-python-test install-npm assets
install-dev: deps-editable install-python-dev install-playwright install-npm assets

install-test: deps-editable install-python-test install-playwright install-npm assets

install: deps-editable install-python install-npm-ci assets

Expand Down
5 changes: 2 additions & 3 deletions funnel/assets/js/schedule_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ const Schedule = {
this.config.slotInterval
);
if (this.config.schedule[session.eventDay]) {
this.config.schedule[session.eventDay].sessions[
session.startTime
].showLabel = true;
this.config.schedule[session.eventDay].sessions[session.startTime].showLabel =
true;
this.config.schedule[session.eventDay].sessions[session.startTime].rooms[
session.room_scoped_name
].talk = session;
Expand Down
8 changes: 4 additions & 4 deletions funnel/static/js/libs/mui.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,10 +723,10 @@
27 === e
? i.destroy()
: 40 === e
? i.increment()
: 38 === e
? i.decrement()
: 13 === e && (i.selectCurrent(), i.destroy());
? i.increment()
: 38 === e
? i.decrement()
: 13 === e && (i.selectCurrent(), i.destroy());
} else (32 !== e && 38 !== e && 40 !== e) || (t.preventDefault(), u(this));
}
}
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ required_plugins = [
]
addopts = [
'--cov-report=term-missing',
'--driver=firefox',
'--disable-socket',
'--allow-unix-socket', # Required for Selenium driver
'--allow-unix-socket', # Required for Playwright tests
'--allow-hosts=127.0.0.1,::1', # Add Docker IPs here
'--strict-markers',
# '--typeguard-packages=funnel,tests', # This breaks on toc.py in markdown
Expand Down
3 changes: 2 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Flask-WTF
furl
geoip2
grapheme
greenlet<3.0 # Required for asyncio in SQLAlchemy, but version conflict in Playwright
gunicorn
html2text
httpx[http2]
Expand Down Expand Up @@ -52,9 +53,9 @@ requests
rich
rq
rq-dashboard @ git+https://github.com/jace/rq-dashboard
SQLAlchemy
sqlalchemy-json
SQLAlchemy-Utils
SQLAlchemy[asyncio]
tweepy
twilio
typing-extensions
Expand Down
8 changes: 6 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:3f7e275da4cb49056d67911958d5b0a59e01971d
# SHA1:2820370229ca38f2e0ba469dbbfe34d0d94623b9
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand Down Expand Up @@ -178,6 +178,10 @@ grapheme==0.6.0
# via
# -r requirements/base.in
# baseframe
greenlet==2.0.2
# via
# -r requirements/base.in
# sqlalchemy
gunicorn==21.2.0
# via -r requirements/base.in
h11==0.14.0
Expand Down Expand Up @@ -419,7 +423,7 @@ sniffio==1.3.0
# via
# anyio
# httpx
sqlalchemy==2.0.23
sqlalchemy[asyncio]==2.0.23
# via
# -r requirements/base.in
# alembic
Expand Down
5 changes: 2 additions & 3 deletions requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ colorama
coverage
coveralls
lxml
py # Not ours; missing dep in pytest-html, which is a dep for pytest-selenium
playwright
Pygments
pytest
pytest-asyncio
pytest-bdd
pytest-cov
pytest-dotenv
pytest-env
pytest-playwright
pytest-rerunfailures
pytest-selenium>=4.0.1
pytest-socket
requests-mock
respx
selenium<4.10 # Selenium 4.10.0 breaks pytest-selenium 4.0.1
sttable
tomlkit
typeguard
49 changes: 15 additions & 34 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:371c24d3103594f1897af063fbc0ccf09017932c
# SHA1:3a02b3918f5d7af80710e10c5fff973974b064aa
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand Down Expand Up @@ -27,18 +27,20 @@ docopt==0.6.2
# via coveralls
iniconfig==2.0.0
# via pytest
outcome==1.3.0.post0
# via trio
parse==1.19.1
# via
# parse-type
# pytest-bdd
parse-type==0.6.2
# via pytest-bdd
playwright==1.36.0
# via
# -r requirements/test.in
# pytest-playwright
pluggy==1.3.0
# via pytest
py==1.11.0
# via -r requirements/test.in
pyee==9.0.4
# via playwright
pytest==7.4.3
# via
# -r requirements/test.in
Expand All @@ -48,16 +50,13 @@ pytest==7.4.3
# pytest-cov
# pytest-dotenv
# pytest-env
# pytest-html
# pytest-metadata
# pytest-playwright
# pytest-rerunfailures
# pytest-selenium
# pytest-socket
# pytest-variables
pytest-asyncio==0.21.1
# via -r requirements/test.in
pytest-base-url==2.0.0
# via pytest-selenium
# via pytest-playwright
pytest-bdd==7.0.0
# via -r requirements/test.in
pytest-cov==4.1.0
Expand All @@ -66,46 +65,28 @@ pytest-dotenv==0.5.2
# via -r requirements/test.in
pytest-env==1.1.1
# via -r requirements/test.in
pytest-html==4.1.0
# via pytest-selenium
pytest-metadata==3.0.0
# via pytest-html
pytest-rerunfailures==12.0
pytest-playwright==0.3.3
# via -r requirements/test.in
pytest-selenium==4.0.1
pytest-rerunfailures==12.0
# via -r requirements/test.in
pytest-socket==0.6.0
# via -r requirements/test.in
pytest-variables==3.0.0
# via pytest-selenium
python-slugify==8.0.1
# via pytest-playwright
requests-mock==1.11.0
# via -r requirements/test.in
respx==0.20.2
# via -r requirements/test.in
selenium==4.9.1
# via
# -r requirements/test.in
# pytest-selenium
sortedcontainers==2.4.0
# via trio
soupsieve==2.5
# via beautifulsoup4
sttable==0.0.1
# via -r requirements/test.in
tenacity==8.2.3
# via pytest-selenium
text-unidecode==1.3
# via python-slugify
tomlkit==0.12.2
# via -r requirements/test.in
trio==0.23.1
# via
# selenium
# trio-websocket
trio-websocket==0.11.1
# via selenium
typeguard==4.1.5
# via -r requirements/test.in
wsproto==1.2.0
# via trio-websocket

# The following packages are considered to be unsafe in a requirements file:
# setuptools
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def firefox_options(firefox_options):
return firefox_options


@pytest.fixture(scope="session")
def browser_context_args(browser_context_args):
return browser_context_args | {'ignore_https_errors': True}


def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
"""Sort tests to run lower level before higher level."""
test_order = (
Expand Down
Loading

0 comments on commit 9bf7daf

Please sign in to comment.