Skip to content

Commit ab78cba

Browse files
chore: Run only smoke tests on PR and all tests on release (#1017)
1 parent 575ce0b commit ab78cba

File tree

3 files changed

+11
-39
lines changed

3 files changed

+11
-39
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "fa469c0", "specHash": "a05e5d7", "version": "0.1.0" }
1+
{ "engineHash": "ee965c4", "specHash": "a05e5d7", "version": "0.1.0" }

.github/workflows/build.yml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ on:
33
pull_request:
44
branches:
55
- sdk-gen
6-
push:
7-
branches:
8-
- sdk-gen
96
jobs:
107
build:
118
runs-on: ubuntu-latest
@@ -29,7 +26,8 @@ jobs:
2926
python -m pip install --upgrade pip
3027
python -m pip install -e .[dev]
3128
python -m pip install tox-gh-actions
32-
- name: Test with tox
29+
- name: All Tests
30+
if: startsWith(github.head_ref, 'codegen-release')
3331
env:
3432
JWT_CONFIG_BASE_64: ${{ secrets.JWT_CONFIG_BASE_64 }}
3533
ADMIN_USER_ID: ${{ secrets.ADMIN_USER_ID }}
@@ -49,41 +47,13 @@ jobs:
4947
SLACK_PARTNER_ITEM_ID: ${{ secrets.SLACK_PARTNER_ITEM_ID }}
5048
run: |
5149
tox
52-
53-
coverage:
54-
name: Coverage report
55-
runs-on: ubuntu-latest
56-
steps:
57-
- name: Checkout
58-
uses: actions/checkout@v4
59-
- name: Set up Python 3.11
60-
uses: actions/setup-python@v4
61-
with:
62-
python-version: '3.11'
63-
- name: Install dependencies
64-
run: |
65-
python -m pip install --upgrade pip
66-
python -m pip install -e .[dev]
67-
python -m pip install coveralls
68-
- name: Send coverage report to Coveralls
69-
run: |
70-
tox -e coverage
71-
coveralls --service=github
50+
- name: Smoke Tests
51+
if: "!startsWith(github.head_ref, 'codegen-release')"
7252
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7453
JWT_CONFIG_BASE_64: ${{ secrets.JWT_CONFIG_BASE_64 }}
75-
ADMIN_USER_ID: ${{ secrets.ADMIN_USER_ID }}
7654
CLIENT_ID: ${{ secrets.CLIENT_ID }}
7755
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
7856
USER_ID: ${{ secrets.USER_ID }}
7957
ENTERPRISE_ID: ${{ secrets.ENTERPRISE_ID }}
80-
BOX_FILE_REQUEST_ID: ${{ secrets.BOX_FILE_REQUEST_ID }}
81-
BOX_EXTERNAL_USER_EMAIL: ${{ secrets.BOX_EXTERNAL_USER_EMAIL }}
82-
BOX_EXTERNAL_USER_ID: ${{ secrets.BOX_EXTERNAL_USER_ID }}
83-
WORKFLOW_FOLDER_ID: ${{ secrets.WORKFLOW_FOLDER_ID }}
84-
APP_ITEM_ASSOCIATION_FILE_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FILE_ID }}
85-
APP_ITEM_ASSOCIATION_FOLDER_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FOLDER_ID }}
86-
APP_ITEM_SHARED_LINK: ${{ secrets.APP_ITEM_SHARED_LINK }}
87-
SLACK_AUTOMATION_USER_ID: ${{ secrets.SLACK_AUTOMATION_USER_ID }}
88-
SLACK_ORG_ID: ${{ secrets.SLACK_ORG_ID }}
89-
SLACK_PARTNER_ITEM_ID: ${{ secrets.SLACK_PARTNER_ITEM_ID }}
58+
run: |
59+
tox -- test/auth.py test/files.py test/downloads.py test/uploads.py

box_sdk_gen/networking/retries.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from abc import abstractmethod
22

3+
from typing import Optional
4+
35
from box_sdk_gen.networking.fetch_options import FetchOptions
46

57
from box_sdk_gen.networking.fetch_response import FetchResponse
@@ -57,7 +59,7 @@ def should_retry(
5759
is_successful: bool = (
5860
fetch_response.status >= 200 and fetch_response.status < 400
5961
)
60-
retry_after_header: str = fetch_response.headers.get('Retry-After')
62+
retry_after_header: Optional[str] = fetch_response.headers.get('Retry-After')
6163
is_accepted_with_retry_after: bool = (
6264
fetch_response.status == 202 and not retry_after_header == None
6365
)
@@ -84,7 +86,7 @@ def retry_after(
8486
fetch_response: FetchResponse,
8587
attempt_number: int,
8688
) -> float:
87-
retry_after_header: str = fetch_response.headers.get('Retry-After')
89+
retry_after_header: Optional[str] = fetch_response.headers.get('Retry-After')
8890
if not retry_after_header == None:
8991
return float(retry_after_header)
9092
randomization: float = random(

0 commit comments

Comments
 (0)