Skip to content

Commit

Permalink
[INTPROD-9211] Python 3.10 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsl committed Apr 5, 2024
1 parent 9567a20 commit 7362d86
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 103 deletions.
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exclude: '^docs/.*$'
default_language_version:
python: python3.8
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand All @@ -24,7 +24,7 @@ repos:
rev: v3.9.0
hooks:
- id: reorder-python-imports
args: [--py38-plus]
args: ['--py310-plus']
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
hooks:
Expand All @@ -34,7 +34,7 @@ repos:
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py38-plus]
args: ['--py310-plus']
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
hooks:
Expand All @@ -43,6 +43,8 @@ repos:
rev: 23.1.0
hooks:
- id: black
args:
- --target-version=py310
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
Expand Down
11 changes: 11 additions & 0 deletions piptools_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# cd ~/src/omnibot && run-piptools
#

pip==19.2
# via -r /code/piptools/bootstrap_ins/requirements.in
setuptools==59.6.0
# via -r /code/piptools/bootstrap_ins/requirements.in
6 changes: 0 additions & 6 deletions piptools_requirements3.txt

This file was deleted.

8 changes: 4 additions & 4 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# piptools: python3.8
# piptools: python3.10


# WSGI HTTP Server for UNIX
Expand Down Expand Up @@ -39,17 +39,17 @@ statsd==3.2.1
# Coroutine-based network library
# License: MIT
# Upstream url: http://www.gevent.org/
gevent==21.1.2
gevent==23.7.0

# Lightweight in-process concurrent programming
# License: MIT
# Upstream url: https://github.com/python-greenlet/greenlet
greenlet==1.1.0
greenlet==2.0.2

# YAML parser and emitter for Python
# License: MIT
# Upstream url: http://pyyaml.org/wiki/PyYAML
PyYAML==5.4
PyYAML==6.0.1

# The AWS SDK for Python
# License: Apache2
Expand Down
118 changes: 118 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# cd ~/src/omnibot && run-piptools
#
attrs==23.2.0
# via pytest
blinker==1.4
# via -r requirements.in
boto3==1.4.5
# via -r requirements.in
botocore==1.5.95
# via
# boto3
# s3transfer
certifi==2024.2.2
# via requests
charset-normalizer==3.3.2
# via requests
click==7.1.2
# via flask
coverage==7.4.4
# via pytest-cov
docutils==0.20.1
# via botocore
flask==1.1.4
# via
# -r requirements.in
# flask-script
flask-script==2.0.5
# via -r requirements.in
gevent==23.7.0
# via -r requirements.in
greenlet==2.0.2
# via
# -r requirements.in
# gevent
gunicorn==19.10.0
# via -r requirements.in
idna==3.6
# via requests
iniconfig==2.0.0
# via pytest
itsdangerous==1.1.0
# via flask
jinja2==2.11.3.post1
# via flask
jmespath==0.10.0
# via
# boto3
# botocore
markupsafe==2.0.1
# via jinja2
packaging==24.0
# via pytest
pluggy==0.13.1
# via pytest
psutil==5.9.8
# via rainbow-saddle
py==1.11.0
# via pytest
pytest==6.2.4
# via
# -r requirements.in
# pytest-cov
# pytest-mock
pytest-cov==2.11.1
# via -r requirements.in
pytest-mock==3.6.1
# via -r requirements.in
python-dateutil==2.9.0.post0
# via botocore
python-json-logger==0.1.11
# via -r requirements.in
python-redis-lock==3.2.0
# via -r requirements.in
pyyaml==6.0.1
# via -r requirements.in
rainbow-saddle==0.4.0
# via -r requirements.in
redis==2.10.6
# via
# -r requirements.in
# python-redis-lock
requests==2.31.0
# via slackclient
s3transfer==0.1.13
# via boto3
six==1.16.0
# via
# python-dateutil
# slackclient
# websocket-client
slackclient==1.3.1
# via -r requirements.in
statsd==3.2.1
# via -r requirements.in
toml==0.10.2
# via pytest
urllib3==2.2.1
# via requests
websocket-client==0.54.0
# via slackclient
werkzeug==1.0.1
# via flask
zope-event==5.0
# via gevent
zope-interface==6.2
# via gevent

pip==19.2
# via -r piptools_requirements.txt
setuptools==59.6.0
# via
# -r piptools_requirements.txt
# zope-event
# zope-interface
57 changes: 0 additions & 57 deletions requirements3.txt

This file was deleted.

29 changes: 14 additions & 15 deletions tests/integration/routes/test_interactive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
from typing import Any
from typing import Dict
from unittest.mock import MagicMock

from flask import Response # noqa: F401
Expand All @@ -18,7 +17,7 @@ def test_dialog_submission_echo_test(
slack_api_call: MagicMock,
):
with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data:
event: Dict[str, Any] = json.loads(json_data.read())
event: dict[str, Any] = json.loads(json_data.read())
resp: Response = client.post(
_ENDPOINT,
data=event,
Expand Down Expand Up @@ -70,8 +69,8 @@ def test_invalid_component_type(
slack_api_call: MagicMock,
):
with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data:
payload: Dict[str, Any] = json.loads(json_data.read())
modified_data: Dict[str, Any] = json.loads(payload["payload"])
payload: dict[str, Any] = json.loads(json_data.read())
modified_data: dict[str, Any] = json.loads(payload["payload"])
modified_data["type"] = "not a valid type"
resp: Response = client.post(
_ENDPOINT,
Expand All @@ -90,8 +89,8 @@ def test_invalid_component_type(

def test_missing_token(client: Client, queue: MagicMock, slack_api_call: MagicMock):
with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data:
payload: Dict[str, Any] = json.loads(json_data.read())
modified_data: Dict[str, Any] = json.loads(payload["payload"])
payload: dict[str, Any] = json.loads(json_data.read())
modified_data: dict[str, Any] = json.loads(payload["payload"])
modified_data.pop("token", None)
resp: Response = client.post(
_ENDPOINT,
Expand All @@ -107,8 +106,8 @@ def test_missing_token(client: Client, queue: MagicMock, slack_api_call: MagicMo

def test_missing_team(client: Client, queue: MagicMock, slack_api_call: MagicMock):
with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data:
payload: Dict[str, Any] = json.loads(json_data.read())
modified_data: Dict[str, Any] = json.loads(payload["payload"])
payload: dict[str, Any] = json.loads(json_data.read())
modified_data: dict[str, Any] = json.loads(payload["payload"])
modified_data.pop("team", None)
resp: Response = client.post(
_ENDPOINT,
Expand All @@ -124,8 +123,8 @@ def test_missing_team(client: Client, queue: MagicMock, slack_api_call: MagicMoc

def test_unsupported_team(client: Client, queue: MagicMock, slack_api_call: MagicMock):
with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data:
payload: Dict[str, Any] = json.loads(json_data.read())
modified_data: Dict[str, Any] = json.loads(payload["payload"])
payload: dict[str, Any] = json.loads(json_data.read())
modified_data: dict[str, Any] = json.loads(payload["payload"])
modified_data["team"]["id"] = "something random"
resp: Response = client.post(
_ENDPOINT,
Expand All @@ -141,8 +140,8 @@ def test_unsupported_team(client: Client, queue: MagicMock, slack_api_call: Magi

def test_invalid_token(client: Client, queue: MagicMock, slack_api_call: MagicMock):
with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data:
payload: Dict[str, Any] = json.loads(json_data.read())
modified_data: Dict[str, Any] = json.loads(payload["payload"])
payload: dict[str, Any] = json.loads(json_data.read())
modified_data: dict[str, Any] = json.loads(payload["payload"])
modified_data["token"] = "something random"
resp: Response = client.post(
_ENDPOINT,
Expand All @@ -165,8 +164,8 @@ def test_invalid_callback_id(
slack_api_call: MagicMock,
):
with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data:
payload: Dict[str, Any] = json.loads(json_data.read())
modified_data: Dict[str, Any] = json.loads(payload["payload"])
payload: dict[str, Any] = json.loads(json_data.read())
modified_data: dict[str, Any] = json.loads(payload["payload"])
modified_data["callback_id"] = "something random"
resp: Response = client.post(
_ENDPOINT,
Expand All @@ -193,7 +192,7 @@ def test_view_submission_synchronous(
with get_mock_data(
"interactive/view_submission_synchronous_test.json",
) as json_data:
event: Dict[str, Any] = json.loads(json_data.read())
event: dict[str, Any] = json.loads(json_data.read())
resp: Response = client.post(
_ENDPOINT,
data=event,
Expand Down
Loading

0 comments on commit 7362d86

Please sign in to comment.