Skip to content

Commit 75596da

Browse files
authored
Restore CI, including Python 2.7 (#492)
* Restores CI to a green state to aid in landing other changes. * Python 2.7 is still covered, but only on Ubuntu and excluding PyPy. Changes are made to `requirements.txt` et al to ensure this works. * Runner versions are pinned to avoid automatic breakage, required statuses are updated to match. * Codecov action is updated, token is now explicitly passed. * Fixes an integration test breaking due to backend changes, to be investigated separately.
1 parent 487793d commit 75596da

File tree

8 files changed

+74
-42
lines changed

8 files changed

+74
-42
lines changed

.github/workflows/ci.yml

+40-22
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,27 @@ jobs:
1010
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
1111
strategy:
1212
matrix:
13-
os: [macos-latest, windows-latest]
14-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy-3.7]
13+
os: [macos-13, windows-latest]
14+
python-version: [3.5, 3.6, 3.7, 3.8, pypy-3.7]
1515
exclude:
1616
- os: windows-latest
1717
python-version: 3.6
1818
include:
19-
- os: ubuntu-latest
19+
- os: ubuntu-20.04
2020
python-version: 3.7
21+
- os: ubuntu-20.04
22+
python-version: 2.7
2123
steps:
2224
- uses: actions/checkout@v2
23-
- name: Setup Python environment
24-
uses: actions/[email protected]
25+
- if: ${{ matrix.python-version == '2.7' }}
26+
name: Setup Python environment (2.7)
27+
run: |
28+
sudo apt-get install python-is-python2
29+
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
30+
python get-pip.py
31+
- if: ${{ matrix.python-version != '2.7' }}
32+
name: Setup Python environment
33+
uses: actions/[email protected]
2534
with:
2635
python-version: ${{ matrix.python-version }}
2736
- name: Install Requirements
@@ -30,19 +39,19 @@ jobs:
3039
pip install flake8 pytest
3140
pip install -r requirements.txt
3241
pip install -r test/requirements.txt
33-
python setup.py install
42+
python setup.py install --user
3443
- name: Run Linter
3544
run: |
3645
flake8 setup.py dropbox example test
3746
- name: Run Unit Tests
3847
run: |
39-
pytest test/unit/test_dropbox_unit.py
48+
pytest -v test/unit/test_dropbox_unit.py
4049
Docs:
41-
runs-on: macos-latest
50+
runs-on: ubuntu-20.04
4251
steps:
4352
- uses: actions/checkout@v2
4453
- name: Setup Python environment
45-
uses: actions/setup-python@v2.2.2
54+
uses: actions/setup-python@v3.1.4
4655
with:
4756
python-version: '3.7'
4857
- name: Install Requirements
@@ -64,18 +73,27 @@ jobs:
6473
runs-on: ${{ matrix.os }}
6574
strategy:
6675
matrix:
67-
os: [macos-latest, windows-latest]
68-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy-3.7]
69-
exclude:
70-
- os: windows-latest
71-
python-version: 3.6
72-
include:
73-
- os: ubuntu-latest
74-
python-version: 3.7
75-
steps:
76+
os: [macos-13, windows-latest]
77+
python-version: [3.5, 3.6, 3.7, 3.8, pypy-3.7]
78+
exclude:
79+
- os: windows-latest
80+
python-version: 3.6
81+
include:
82+
- os: ubuntu-20.04
83+
python-version: 3.7
84+
- os: ubuntu-20.04
85+
python-version: 2.7
86+
steps:
7687
- uses: actions/[email protected]
77-
- name: Setup Python environment
78-
uses: actions/[email protected]
88+
- if: ${{ matrix.python-version == '2.7' }}
89+
name: Setup Python environment (2.7)
90+
run: |
91+
sudo apt-get install python-is-python2
92+
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
93+
python get-pip.py
94+
- if: ${{ matrix.python-version != '2.7' }}
95+
name: Setup Python environment
96+
uses: actions/[email protected]
7997
with:
8098
python-version: ${{ matrix.python-version }}
8199
- name: Install Requirements
@@ -84,7 +102,7 @@ jobs:
84102
pip install flake8 pytest
85103
pip install -r requirements.txt
86104
pip install -r test/requirements.txt
87-
python setup.py install
105+
python setup.py install --user
88106
- name: Run Integration Tests
89107
env:
90108
LEGACY_USER_DROPBOX_TOKEN: ${{ secrets.LEGACY_USER_DROPBOX_TOKEN }}
@@ -101,4 +119,4 @@ jobs:
101119
SCOPED_TEAM_REFRESH_TOKEN: ${{ secrets.SCOPED_TEAM_REFRESH_TOKEN }}
102120
DROPBOX_SHARED_LINK: ${{ secrets.DROPBOX_SHARED_LINK }}
103121
run: |
104-
pytest test/integration/test_dropbox.py
122+
pytest -v test/integration/test_dropbox.py

.github/workflows/coverage.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Setup Python environment
16-
uses: actions/setup-python@v2.2.2
16+
uses: actions/setup-python@v3.1.4
1717
with:
1818
python-version: '3.7'
1919
- name: Install Requirements
@@ -28,16 +28,17 @@ jobs:
2828
coverage run --rcfile=.coveragerc -m pytest test/unit/test_dropbox_unit.py
2929
coverage xml
3030
- name: Publish Coverage
31-
uses: codecov/codecov-action@v1.3.2
31+
uses: codecov/codecov-action@v3.1.6
3232
with:
33+
token: ${{ secrets.CODECOV_TOKEN }}
3334
flags: unit
3435
fail_ci_if_error: true
3536
IntegrationCoverage:
3637
runs-on: ubuntu-latest
3738
steps:
3839
- uses: actions/checkout@v2
3940
- name: Setup Python environment
40-
uses: actions/setup-python@v2.2.2
41+
uses: actions/setup-python@v3.1.4
4142
with:
4243
python-version: '3.7'
4344
- name: Install Requirements
@@ -66,7 +67,8 @@ jobs:
6667
coverage run --rcfile=.coveragerc -m pytest test/integration/test_dropbox.py
6768
coverage xml
6869
- name: Publish Coverage
69-
uses: codecov/codecov-action@v1.3.2
70+
uses: codecov/codecov-action@v3.1.6
7071
with:
72+
token: ${{ secrets.CODECOV_TOKEN }}
7173
flags: integration
72-
fail_ci_if_error: true
74+
fail_ci_if_error: true

.github/workflows/pypiupload.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ on:
99

1010
jobs:
1111
deploy:
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-20.04
1313
strategy:
1414
matrix:
1515
python-version: [2.7, 3.x]
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Setup Python
20-
uses: actions/[email protected]
18+
- uses: actions/[email protected]
19+
- if: ${{ matrix.python-version == '2.7' }}
20+
name: Setup Python environment (2.7)
21+
run: |
22+
sudo apt-get install python-is-python2
23+
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
24+
python get-pip.py
25+
- if: ${{ matrix.python-version != '2.7' }}
26+
name: Setup Python environment
27+
uses: actions/[email protected]
2128
with:
2229
python-version: ${{ matrix.python-version }}
2330
- name: Install dependencies

.github/workflows/spec_update.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v2
1212
- name: Setup Python environment
13-
uses: actions/setup-python@v2.2.2
13+
uses: actions/setup-python@v3.1.4
1414
with:
1515
python-version: 3.7
1616
- name: Get current time

requirements.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Dependencies required for installation (keep in sync with setup.py)
2-
requests >= 2.16.2
2+
requests<2.30
3+
urllib3<2
34
six >= 1.12.0
4-
stone >= 2
5+
stone>=2,<3.3.3
56
# Other dependencies for development
67
ply
78
pytest
8-
pytest-runner
9+
pytest-runner==5.2.0
910
sphinx
1011
twine
1112
wheel

setup.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
version = eval(line.split('=', 1)[1].strip()) # pylint: disable=eval-used
2626

2727
install_reqs = [
28-
'requests >= 2.16.2',
28+
'requests<2.30',
29+
'urllib3<2',
2930
'six >= 1.12.0',
30-
'stone >= 2',
31+
'stone>=2,<3.3.3',
3132
]
3233

3334
setup_requires = [
3435
# Pin pytest-runner to 5.2.0, since 5.3.0 uses `find_namespaces` directive, not supported in
3536
# Python 2.7
36-
'pytest-runner == 5.2.0',
37+
'pytest-runner==5.2.0',
3738
]
3839

3940
# WARNING: This imposes limitations on test/requirements.txt such that the

test/integration/test_dropbox.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from dropbox.exceptions import (
2727
ApiError,
2828
AuthError,
29-
BadInputError,
29+
# BadInputError,
3030
PathRootError,
3131
)
3232
from dropbox.files import (
@@ -153,9 +153,12 @@ def test_default_oauth2_urls(self):
153153
def test_bad_auth(self):
154154
# Test malformed token
155155
malformed_token_dbx = Dropbox(MALFORMED_TOKEN)
156-
with pytest.raises(BadInputError,) as cm:
156+
# TODO: backend is no longer returning `BadInputError`
157+
# with pytest.raises(BadInputError,) as cm:
158+
# malformed_token_dbx.files_list_folder('')
159+
# assert 'token is malformed' in cm.value.message
160+
with pytest.raises(AuthError,):
157161
malformed_token_dbx.files_list_folder('')
158-
assert 'token is malformed' in cm.value.message
159162

160163
# Test reasonable-looking invalid token
161164
invalid_token_dbx = Dropbox(INVALID_TOKEN)

test/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pytest
22
mock
33
pytest-mock
44
coverage
5-
stone>=2
5+
stone>=2,<3.3.3

0 commit comments

Comments
 (0)