Skip to content

Commit bf45d6d

Browse files
PBE-111 (#141)
* fix: tests and linting * chore: add more venvs * chore: same ignores as Makefile * chore: update deps * fix: add support for 3.11 * ci: add support for 3.11 * chore: update CODEOWNERS
1 parent c4948a2 commit bf45d6d

File tree

12 files changed

+22
-24
lines changed

12 files changed

+22
-24
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @ferhatelmas
1+
* @JimmyPettersson85 @xernobyl @yaziine

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
max-parallel: 1
1818
matrix:
19-
python: ['3.7', '3.8', '3.9', '3.10']
19+
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
2020
steps:
2121
- uses: actions/checkout@v3
2222
with:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,9 @@ secrets.*sh
6161
.python-version
6262

6363
.venv
64+
.venv3.7
65+
.venv3.8
66+
.venv3.9
67+
.venv3.10
68+
.venv3.11
6469
.envrc

dotgit/hooks/pre-commit-format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if ! black stream --check -q; then
1010
exit 1
1111
fi
1212

13-
if ! flake8 --ignore=E501,E225,W293,W503 stream; then
13+
if ! flake8 --ignore=E501,E225,W293,W503,F401 stream; then
1414
echo
1515
echo "commit is aborted because there are some error prone issues in your changes as printed above"
1616
echo "your changes are still staged, you can accept formatting changes with git add or ignore them by adding --no-verify to git commit"

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
from stream import __version__, __maintainer__, __email__, __license__
66

77
install_requires = [
8-
"requests>=2.3.0,<3",
9-
"pyjwt>=2.0.0,<3",
10-
"pytz>=2019.3",
11-
"aiohttp>=3.6.0",
8+
"requests>=2.28.0,<3",
9+
"pyjwt>=2.6.0,<3",
10+
"pytz>=2022.7.1",
11+
"aiohttp>=3.8.4",
1212
]
1313
tests_require = ["pytest", "pytest-cov", "python-dateutil", "pytest-asyncio"]
1414
ci_require = ["black", "flake8", "pytest-cov"]
@@ -52,6 +52,7 @@
5252
"Programming Language :: Python :: 3.8",
5353
"Programming Language :: Python :: 3.9",
5454
"Programming Language :: Python :: 3.10",
55+
"Programming Language :: Python :: 3.11",
5556
"Topic :: Software Development :: Libraries :: Python Modules",
5657
],
5758
)

stream/client/client.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ def activity_partial_update(
169169
return self.activities_partial_update(updates=[data])
170170

171171
def activities_partial_update(self, updates=None):
172-
173172
auth_token = self.create_jwt_token("activities", "*", feed_id="*")
174173

175174
data = {"changes": updates or []}
@@ -195,7 +194,6 @@ def create_redirect_url(self, target_url, user_id, events):
195194
return prepared_request.url
196195

197196
def track_engagements(self, engagements):
198-
199197
auth_token = self.create_jwt_token("*", "*", feed_id="*")
200198
self.post(
201199
"engagement/",
@@ -205,7 +203,6 @@ def track_engagements(self, engagements):
205203
)
206204

207205
def track_impressions(self, impressions):
208-
209206
auth_token = self.create_jwt_token("*", "*", feed_id="*")
210207
self.post("impression/", auth_token, data=impressions, service_name="analytics")
211208

stream/collections/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def delete(self, collection_name, id):
7272

7373

7474
class BaseCollection(AbstractCollection, ABC):
75-
7675
URL = "collections/"
7776
SERVICE_NAME = "api"
7877

stream/personalization/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def delete(self, resource, **params):
1616

1717

1818
class BasePersonalization(AbstractPersonalization, ABC):
19-
2019
SERVICE_NAME = "personalization"
2120

2221
def __init__(self, client, token):

stream/reactions/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def filter(self, **params):
4444

4545

4646
class BaseReactions(AbstractReactions, ABC):
47-
4847
API_ENDPOINT = "reaction/"
4948
SERVICE_NAME = "api"
5049

stream/tests/conftest.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import asyncio
22
import os
33
import sys
4+
import pytest_asyncio
45
from uuid import uuid4
56

6-
import pytest
77

88
from stream import connect
99

@@ -17,15 +17,15 @@ async def _parse_response(*args, **kwargs):
1717
return _parse_response
1818

1919

20-
@pytest.fixture(scope="module")
20+
@pytest_asyncio.fixture(scope="module")
2121
def event_loop():
2222
"""Create an instance of the default event loop for each test case."""
2323
loop = asyncio.get_event_loop_policy().new_event_loop()
2424
yield loop
2525
loop.close()
2626

2727

28-
@pytest.fixture
28+
@pytest_asyncio.fixture
2929
async def async_client():
3030
key = os.getenv("STREAM_KEY")
3131
secret = os.getenv("STREAM_SECRET")
@@ -44,31 +44,31 @@ async def async_client():
4444
yield client
4545

4646

47-
@pytest.fixture
47+
@pytest_asyncio.fixture
4848
def user1(async_client):
4949
return async_client.feed("user", f"1-{uuid4()}")
5050

5151

52-
@pytest.fixture
52+
@pytest_asyncio.fixture
5353
def user2(async_client):
5454
return async_client.feed("user", f"2-{uuid4()}")
5555

5656

57-
@pytest.fixture
57+
@pytest_asyncio.fixture
5858
def aggregated2(async_client):
5959
return async_client.feed("aggregated", f"2-{uuid4()}")
6060

6161

62-
@pytest.fixture
62+
@pytest_asyncio.fixture
6363
def aggregated3(async_client):
6464
return async_client.feed("aggregated", f"3-{uuid4()}")
6565

6666

67-
@pytest.fixture
67+
@pytest_asyncio.fixture
6868
def topic(async_client):
6969
return async_client.feed("topic", f"1-{uuid4()}")
7070

7171

72-
@pytest.fixture
72+
@pytest_asyncio.fixture
7373
def flat3(async_client):
7474
return async_client.feed("flat", f"3-{uuid4()}")

stream/tests/test_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,6 @@ def test_activity_partial_update(self):
12941294
self.assertEqual(updated, expected)
12951295

12961296
def test_activities_partial_update(self):
1297-
12981297
feed = self.c.feed("user", uuid4())
12991298
feed.add_activities(
13001299
[

stream/users/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def delete(self, user_id):
2424

2525

2626
class BaseUsers(AbstractUsers, ABC):
27-
2827
API_ENDPOINT = "user/"
2928
SERVICE_NAME = "api"
3029

0 commit comments

Comments
 (0)