Skip to content

Commit e474989

Browse files
authored
Merge pull request #30 from trustpilot/SP-148-gha
chore: migrate to GHA
2 parents 345f28f + 1ab882f commit e474989

File tree

7 files changed

+918
-609
lines changed

7 files changed

+918
-609
lines changed

.github/workflows/pushes.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and release
2+
3+
'on':
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
22+
steps:
23+
- name: Checkout the repo
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.head_ref }}
27+
28+
- name: Setup Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
cache: 'pip'
33+
34+
- name: Install poetry
35+
run: |
36+
pip install --upgrade pip
37+
pip install poetry
38+
python -V
39+
pip -V
40+
poetry -V
41+
poetry config virtualenvs.create false
42+
shell: bash
43+
44+
- name: poetry install
45+
run: poetry install --verbose
46+
shell: bash
47+
48+
- name: Lint
49+
run: poetry run black --check .
50+
shell: bash
51+
52+
- name: Test
53+
run: poetry run pytest -vvv tests
54+
shell: bash

.travis.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

poetry.lock

Lines changed: 853 additions & 578 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ classifiers = [
1515
"Development Status :: 5 - Production/Stable",
1616
"Intended Audience :: Developers",
1717
"Natural Language :: English",
18-
"Programming Language :: Python :: 3.7",
1918
"Programming Language :: Python :: 3.8",
20-
"Programming Language :: Python :: 3.9"
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13"
2124
]
2225

2326
[tool.poetry.dependencies]

tests/test_cli.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def setUp(self):
4949
}
5050
}
5151
self.response_mock = response_mock
52-
self.expected_output = u"""{
52+
self.expected_output = """{
5353
"url": "https://api.trustpilot.com/v1/business-units/5400267300006400057a0113/reviews",
5454
"status": 401,
5555
"content": {
@@ -62,7 +62,7 @@ def setUp(self):
6262
}
6363
}
6464
"""
65-
self.expected_verbose_output = u"""{
65+
self.expected_verbose_output = """{
6666
"url": "https://api.trustpilot.com/v1/business-units/5400267300006400057a0113/reviews",
6767
"status": 401,
6868
"headers": {
@@ -106,7 +106,6 @@ def test_create_access_token(self, client_mock):
106106
@mock.patch("trustpilot.cli.client", autospec=True)
107107
@mock.patch("trustpilot.cli.auth")
108108
def test_no_verbosity_with_get(self, auth_mock, client_mock):
109-
110109
client_mock.get.return_value = self.response_mock
111110

112111
result = self.runner.invoke(
@@ -278,7 +277,6 @@ def assert_output_equal(self, output, expected_output):
278277
@mock.patch("trustpilot.cli.client", autospec=True)
279278
@mock.patch("trustpilot.cli.auth")
280279
def test_no_verbosity_with_get(self, auth_mock, client_mock):
281-
282280
client_mock.get.return_value = self.response_mock
283281

284282
result = self.runner.invoke(

trustpilot/async_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def setup(
3030
user_agent=None,
3131
**kwargs
3232
):
33-
3433
self.api_host = api_host or environ.get(
3534
"TRUSTPILOT_API_HOST", "https://api.trustpilot.com"
3635
)
@@ -113,7 +112,6 @@ async def post(self, url, *args, **kwargs):
113112
return await self.authenticated_request("post", url, *args, **kwargs)
114113

115114
async def get(self, url, *args, **kwargs):
116-
117115
return await self.authenticated_request("get", url, *args, **kwargs)
118116

119117
async def put(self, url, *args, **kwargs):

trustpilot/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def setup(
5050
user_agent=None,
5151
**kwargs
5252
):
53-
5453
self.api_host = api_host or environ.get(
5554
"TRUSTPILOT_API_HOST", "https://api.trustpilot.com"
5655
)
@@ -112,7 +111,10 @@ def _post_request_callback(self, response, *args, **kwargs):
112111
req = response.request
113112
retry = getattr(req, "authentication_retry", True)
114113

115-
if retry and response.status_code in (requests.codes.unauthorized, requests.codes.forbidden):
114+
if retry and response.status_code in (
115+
requests.codes.unauthorized,
116+
requests.codes.forbidden,
117+
):
116118
logger.debug(
117119
{"message": "reauthenticating and retrying once", "url": req.url}
118120
)

0 commit comments

Comments
 (0)