Skip to content

Commit

Permalink
Restore CI, including Python 2.7 (#492)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
maxbelanger committed May 8, 2024
1 parent 487793d commit 75596da
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 42 deletions.
62 changes: 40 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@ jobs:
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy-3.7]
os: [macos-13, windows-latest]
python-version: [3.5, 3.6, 3.7, 3.8, pypy-3.7]
exclude:
- os: windows-latest
python-version: 3.6
include:
- os: ubuntu-latest
- os: ubuntu-20.04
python-version: 3.7
- os: ubuntu-20.04
python-version: 2.7
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
- if: ${{ matrix.python-version == '2.7' }}
name: Setup Python environment (2.7)
run: |
sudo apt-get install python-is-python2
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
- if: ${{ matrix.python-version != '2.7' }}
name: Setup Python environment
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
- name: Install Requirements
Expand All @@ -30,19 +39,19 @@ jobs:
pip install flake8 pytest
pip install -r requirements.txt
pip install -r test/requirements.txt
python setup.py install
python setup.py install --user
- name: Run Linter
run: |
flake8 setup.py dropbox example test
- name: Run Unit Tests
run: |
pytest test/unit/test_dropbox_unit.py
pytest -v test/unit/test_dropbox_unit.py
Docs:
runs-on: macos-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: '3.7'
- name: Install Requirements
Expand All @@ -64,18 +73,27 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy-3.7]
exclude:
- os: windows-latest
python-version: 3.6
include:
- os: ubuntu-latest
python-version: 3.7
steps:
os: [macos-13, windows-latest]
python-version: [3.5, 3.6, 3.7, 3.8, pypy-3.7]
exclude:
- os: windows-latest
python-version: 3.6
include:
- os: ubuntu-20.04
python-version: 3.7
- os: ubuntu-20.04
python-version: 2.7
steps:
- uses: actions/checkout@v2.3.4
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
- if: ${{ matrix.python-version == '2.7' }}
name: Setup Python environment (2.7)
run: |
sudo apt-get install python-is-python2
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
- if: ${{ matrix.python-version != '2.7' }}
name: Setup Python environment
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
- name: Install Requirements
Expand All @@ -84,7 +102,7 @@ jobs:
pip install flake8 pytest
pip install -r requirements.txt
pip install -r test/requirements.txt
python setup.py install
python setup.py install --user
- name: Run Integration Tests
env:
LEGACY_USER_DROPBOX_TOKEN: ${{ secrets.LEGACY_USER_DROPBOX_TOKEN }}
Expand All @@ -101,4 +119,4 @@ jobs:
SCOPED_TEAM_REFRESH_TOKEN: ${{ secrets.SCOPED_TEAM_REFRESH_TOKEN }}
DROPBOX_SHARED_LINK: ${{ secrets.DROPBOX_SHARED_LINK }}
run: |
pytest test/integration/test_dropbox.py
pytest -v test/integration/test_dropbox.py
12 changes: 7 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: '3.7'
- name: Install Requirements
Expand All @@ -28,16 +28,17 @@ jobs:
coverage run --rcfile=.coveragerc -m pytest test/unit/test_dropbox_unit.py
coverage xml
- name: Publish Coverage
uses: codecov/codecov-action@v1.3.2
uses: codecov/codecov-action@v3.1.6
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
fail_ci_if_error: true
IntegrationCoverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: '3.7'
- name: Install Requirements
Expand Down Expand Up @@ -66,7 +67,8 @@ jobs:
coverage run --rcfile=.coveragerc -m pytest test/integration/test_dropbox.py
coverage xml
- name: Publish Coverage
uses: codecov/codecov-action@v1.3.2
uses: codecov/codecov-action@v3.1.6
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration
fail_ci_if_error: true
fail_ci_if_error: true
15 changes: 11 additions & 4 deletions .github/workflows/pypiupload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ on:

jobs:
deploy:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [2.7, 3.x]

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2.2.2
- uses: actions/checkout@v2.3.4
- if: ${{ matrix.python-version == '2.7' }}
name: Setup Python environment (2.7)
run: |
sudo apt-get install python-is-python2
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
- if: ${{ matrix.python-version != '2.7' }}
name: Setup Python environment
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spec_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: 3.7
- name: Get current time
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Dependencies required for installation (keep in sync with setup.py)
requests >= 2.16.2
requests<2.30
urllib3<2
six >= 1.12.0
stone >= 2
stone>=2,<3.3.3
# Other dependencies for development
ply
pytest
pytest-runner
pytest-runner==5.2.0
sphinx
twine
wheel
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
version = eval(line.split('=', 1)[1].strip()) # pylint: disable=eval-used

install_reqs = [
'requests >= 2.16.2',
'requests<2.30',
'urllib3<2',
'six >= 1.12.0',
'stone >= 2',
'stone>=2,<3.3.3',
]

setup_requires = [
# Pin pytest-runner to 5.2.0, since 5.3.0 uses `find_namespaces` directive, not supported in
# Python 2.7
'pytest-runner == 5.2.0',
'pytest-runner==5.2.0',
]

# WARNING: This imposes limitations on test/requirements.txt such that the
Expand Down
9 changes: 6 additions & 3 deletions test/integration/test_dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from dropbox.exceptions import (
ApiError,
AuthError,
BadInputError,
# BadInputError,
PathRootError,
)
from dropbox.files import (
Expand Down Expand Up @@ -153,9 +153,12 @@ def test_default_oauth2_urls(self):
def test_bad_auth(self):
# Test malformed token
malformed_token_dbx = Dropbox(MALFORMED_TOKEN)
with pytest.raises(BadInputError,) as cm:
# TODO: backend is no longer returning `BadInputError`
# with pytest.raises(BadInputError,) as cm:
# malformed_token_dbx.files_list_folder('')
# assert 'token is malformed' in cm.value.message
with pytest.raises(AuthError,):
malformed_token_dbx.files_list_folder('')
assert 'token is malformed' in cm.value.message

# Test reasonable-looking invalid token
invalid_token_dbx = Dropbox(INVALID_TOKEN)
Expand Down
2 changes: 1 addition & 1 deletion test/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pytest
mock
pytest-mock
coverage
stone>=2
stone>=2,<3.3.3

0 comments on commit 75596da

Please sign in to comment.