From 3a3a19d53a07d3b24c1b8d8faf68ee4c8b526ee5 Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Tue, 7 May 2024 12:59:07 -0700 Subject: [PATCH 01/10] wip: restore ci, including python 2.7 --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++--------- .github/workflows/pypiupload.yml | 11 +++++++-- requirements.txt | 7 +++--- setup.py | 7 +++--- test/requirements.txt | 2 +- 5 files changed, 46 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ecf98c9..b18131a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,17 +10,26 @@ 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 + - 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@v2.2.2 with: python-version: ${{ matrix.python-version }} @@ -38,7 +47,7 @@ jobs: run: | pytest test/unit/test_dropbox_unit.py Docs: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v2 - name: Setup Python environment @@ -64,17 +73,26 @@ 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] + 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.3.4 - - name: Setup Python environment + - 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@v2.2.2 with: python-version: ${{ matrix.python-version }} @@ -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 \ No newline at end of file + pytest test/integration/test_dropbox.py diff --git a/.github/workflows/pypiupload.yml b/.github/workflows/pypiupload.yml index 3c7f1675..49aaff1c 100644 --- a/.github/workflows/pypiupload.yml +++ b/.github/workflows/pypiupload.yml @@ -9,14 +9,21 @@ 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 + - 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@v2.2.2 with: python-version: ${{ matrix.python-version }} diff --git a/requirements.txt b/requirements.txt index 2c55c04b..40df1b1e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,12 @@ # Dependencies required for installation (keep in sync with setup.py) -requests >= 2.16.2 +requests>=2.27 +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 diff --git a/setup.py b/setup.py index efbd57de..7d3a9555 100644 --- a/setup.py +++ b/setup.py @@ -25,15 +25,16 @@ version = eval(line.split('=', 1)[1].strip()) # pylint: disable=eval-used install_reqs = [ - 'requests >= 2.16.2', + 'requests>=2.27', + '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 diff --git a/test/requirements.txt b/test/requirements.txt index c6433e33..9f263bd8 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -2,4 +2,4 @@ pytest mock pytest-mock coverage -stone>=2 +stone>=2,<3.3.3 From 419d263a85bf72e5bebe874c7551e75534f2d9fc Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Tue, 7 May 2024 13:20:31 -0700 Subject: [PATCH 02/10] working requests, fix lack of effective venv in 2.7 --- .github/workflows/ci.yml | 28 +++++++++++++++------------- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b18131a5..f581bd94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,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 Linter run: | flake8 setup.py dropbox example test @@ -73,17 +73,17 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - 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: + 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 - if: ${{ matrix.python-version == '2.7' }} name: Setup Python environment (2.7) @@ -102,7 +102,9 @@ jobs: pip install flake8 pytest pip install -r requirements.txt pip install -r test/requirements.txt - python setup.py install + pip install setuptools wheel twine # XXX + python setup.py bdist_wheel # XXX + python setup.py install --user - name: Run Integration Tests env: LEGACY_USER_DROPBOX_TOKEN: ${{ secrets.LEGACY_USER_DROPBOX_TOKEN }} diff --git a/requirements.txt b/requirements.txt index 40df1b1e..2b5b9a8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Dependencies required for installation (keep in sync with setup.py) -requests>=2.27 +requests<2.30 urllib3<2 six >= 1.12.0 stone>=2,<3.3.3 diff --git a/setup.py b/setup.py index 7d3a9555..6e748976 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ version = eval(line.split('=', 1)[1].strip()) # pylint: disable=eval-used install_reqs = [ - 'requests>=2.27', + 'requests<2.30', 'urllib3<2', 'six >= 1.12.0', 'stone>=2,<3.3.3', From 13d9843cdc0bb46aab45c13142521f399cc0d728 Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Tue, 7 May 2024 13:30:46 -0700 Subject: [PATCH 03/10] verbose tests --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f581bd94..0c3f7e44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: 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-13 steps: @@ -121,4 +121,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 From ee077d24bc2fbb4b9c9c27f915c0731cf9882d2c Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Tue, 7 May 2024 13:31:53 -0700 Subject: [PATCH 04/10] temporary fix for backend change --- test/integration/test_dropbox.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration/test_dropbox.py b/test/integration/test_dropbox.py index 5aeb3232..b950cb90 100644 --- a/test/integration/test_dropbox.py +++ b/test/integration/test_dropbox.py @@ -26,7 +26,7 @@ from dropbox.exceptions import ( ApiError, AuthError, - BadInputError, + # BadInputError, PathRootError, ) from dropbox.files import ( @@ -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) From 392f92cfac68d9da63753fcfe6ab7acaad096770 Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Tue, 7 May 2024 13:40:24 -0700 Subject: [PATCH 05/10] much better to run this on ubuntu --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c3f7e44..1152fd35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: run: | pytest -v test/unit/test_dropbox_unit.py Docs: - runs-on: macos-13 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Setup Python environment From 6bef343bc19d787d2295eaa482a063f3a76ebb05 Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Tue, 7 May 2024 13:42:52 -0700 Subject: [PATCH 06/10] should match exactly --- .github/workflows/pypiupload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypiupload.yml b/.github/workflows/pypiupload.yml index 49aaff1c..6b61849e 100644 --- a/.github/workflows/pypiupload.yml +++ b/.github/workflows/pypiupload.yml @@ -15,7 +15,7 @@ jobs: python-version: [2.7, 3.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2.3.4 - if: ${{ matrix.python-version == '2.7' }} name: Setup Python environment (2.7) run: | From 41bce7f16910e6a7e9735709f08798caf1b614aa Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Tue, 7 May 2024 13:43:11 -0700 Subject: [PATCH 07/10] cleanup --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1152fd35..0ba334c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,8 +102,6 @@ jobs: pip install flake8 pytest pip install -r requirements.txt pip install -r test/requirements.txt - pip install setuptools wheel twine # XXX - python setup.py bdist_wheel # XXX python setup.py install --user - name: Run Integration Tests env: From fb5ceb21e498c32eaa52edffebe0efb2cdb80701 Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Wed, 8 May 2024 14:52:00 -0700 Subject: [PATCH 08/10] bump codecov action --- .github/workflows/coverage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 87cf19d1..0b223260 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -28,7 +28,7 @@ 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: flags: unit fail_ci_if_error: true @@ -66,7 +66,7 @@ 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: flags: integration - fail_ci_if_error: true \ No newline at end of file + fail_ci_if_error: true From d9358d8ceb7cbf90bff24dd0227bf6ef86a049b2 Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Wed, 8 May 2024 14:54:54 -0700 Subject: [PATCH 09/10] bump setup-python --- .github/workflows/ci.yml | 6 +++--- .github/workflows/coverage.yml | 4 ++-- .github/workflows/pypiupload.yml | 2 +- .github/workflows/spec_update.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ba334c4..c0d85f3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: python get-pip.py - if: ${{ matrix.python-version != '2.7' }} name: Setup Python environment - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v3.1.4 with: python-version: ${{ matrix.python-version }} - name: Install Requirements @@ -51,7 +51,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 @@ -93,7 +93,7 @@ jobs: python get-pip.py - if: ${{ matrix.python-version != '2.7' }} name: Setup Python environment - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v3.1.4 with: python-version: ${{ matrix.python-version }} - name: Install Requirements diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0b223260..4f93c24a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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 @@ -37,7 +37,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 diff --git a/.github/workflows/pypiupload.yml b/.github/workflows/pypiupload.yml index 6b61849e..874a32b4 100644 --- a/.github/workflows/pypiupload.yml +++ b/.github/workflows/pypiupload.yml @@ -24,7 +24,7 @@ jobs: python get-pip.py - if: ${{ matrix.python-version != '2.7' }} name: Setup Python environment - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v3.1.4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.github/workflows/spec_update.yml b/.github/workflows/spec_update.yml index f4a60c7c..5010e1a8 100644 --- a/.github/workflows/spec_update.yml +++ b/.github/workflows/spec_update.yml @@ -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 From 8cca9df24e6cc2e9af8c5d7e3e069d706351b7a1 Mon Sep 17 00:00:00 2001 From: Max Belanger Date: Wed, 8 May 2024 15:09:24 -0700 Subject: [PATCH 10/10] token is now required --- .github/workflows/coverage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 4f93c24a..7cab535b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -30,6 +30,7 @@ jobs: - name: Publish Coverage uses: codecov/codecov-action@v3.1.6 with: + token: ${{ secrets.CODECOV_TOKEN }} flags: unit fail_ci_if_error: true IntegrationCoverage: @@ -68,5 +69,6 @@ jobs: - name: Publish Coverage uses: codecov/codecov-action@v3.1.6 with: + token: ${{ secrets.CODECOV_TOKEN }} flags: integration fail_ci_if_error: true