Skip to content

Commit 94ffd75

Browse files
Use test helpers and fixtures from b2sdk, drop python 3.8 support
1 parent 57f8bae commit 94ffd75

24 files changed

+1029
-1718
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,17 @@ jobs:
8686
fail-fast: false
8787
matrix:
8888
os: ["ubuntu-latest", "ubuntu-24.04-arm", "macos-latest", "windows-latest"]
89-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"]
89+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"]
9090
exclude:
9191
- os: "macos-latest"
9292
python-version: "pypy3.10"
9393
- os: "windows-latest"
9494
python-version: "pypy3.10"
9595
# Workaround for https://github.com/actions/setup-python/issues/696
96-
- os: "macos-latest"
97-
python-version: 3.8
9896
- os: "macos-latest"
9997
python-version: 3.9
10098
include:
10199
# Workaround for https://github.com/actions/setup-python/issues/696
102-
- os: "macos-13"
103-
python-version: 3.8
104100
- os: "macos-13"
105101
python-version: 3.9
106102
steps:
@@ -129,7 +125,7 @@ jobs:
129125
run: nox -vs integration -p ${{ matrix.python-version }} -- -m "not require_secrets"
130126
- name: Run integration tests (with secrets)
131127
# Limit CI workload by running integration tests with secrets only on edge Python versions.
132-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.8", "pypy3.10", "3.13"]'), matrix.python-version) }}
128+
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.9", "pypy3.10", "3.13"]'), matrix.python-version) }}
133129
run: nox -vs integration -p ${{ matrix.python-version }} -- -m "require_secrets" --cleanup
134130
test-docker:
135131
timeout-minutes: 90

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ doc/source/main_help.rst
1818
doc/source/subcommands
1919
Dockerfile
2020
b2/licenses_output.txt
21-
*.spec
21+
*.spec
22+
.env

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ With `nox`, you can run different sessions (default are `lint` and `test`):
6363

6464
* `format` -> Format the code.
6565
* `lint` -> Run linters.
66-
* `test` (`test-3.8`, `test-3.9`, `test-3.10`, `test-3.11`) -> Run test suite.
66+
* `test` (`test-3.9`, `test-3.10`, `test-3.11`) -> Run test suite.
6767
* `cover` -> Perform coverage analysis.
6868
* `build` -> Build the distribution.
6969
* `generate_dockerfile` -> generate dockerfile

b2/_internal/_cli/argcompleters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ def b2uri_file_completer(prefix: str, parsed_args, **kwargs):
6161
from b2sdk.v3 import LIST_FILE_NAMES_MAX_LIMIT, unprintable_to_hex
6262

6363
from b2._internal._cli.b2api import _get_b2api_for_profile
64-
from b2._internal._utils.python_compat import removeprefix
6564
from b2._internal._utils.uri import parse_b2_uri
6665

6766
api = _get_b2api_for_profile(getattr(parsed_args, 'profile', None))
6867
if prefix.startswith('b2://'):
69-
prefix_without_scheme = removeprefix(prefix, 'b2://')
68+
prefix_without_scheme = prefix.removeprefix('b2://')
7069
if '/' not in prefix_without_scheme:
7170
return [
7271
f'b2://{unprintable_to_hex(bucket.name)}/'

b2/_internal/_cli/b2args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import argparse
1515
import functools
1616
from os import environ
17-
from typing import Optional, Tuple, Union
17+
from typing import Optional, Union
1818

1919
from b2._internal._cli.arg_parser_types import wrap_with_argument_type_error
2020
from b2._internal._cli.argcompleters import b2uri_file_completer, bucket_name_completer
@@ -242,5 +242,5 @@ def add_b2id_or_file_like_b2_uri_or_bucket_name_argument(
242242
return arg
243243

244244

245-
def get_keyid_and_key_from_env_vars() -> Tuple[Optional[str], Optional[str]]:
245+
def get_keyid_and_key_from_env_vars() -> tuple[Optional[str], Optional[str]]:
246246
return environ.get(B2_APPLICATION_KEY_ID_ENV_VAR), environ.get(B2_APPLICATION_KEY_ENV_VAR)

b2/_internal/_utils/python_compat.py

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

b2/_internal/_utils/uri.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
import dataclasses
1313
import re
14+
from collections.abc import Sequence
1415
from functools import singledispatchmethod
1516
from pathlib import Path
16-
from typing import Sequence
1717

1818
from b2sdk.v3 import (
1919
B2Api,

b2/_internal/console_tool.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import warnings
1818

1919
from b2._internal._cli.autocomplete_cache import AUTOCOMPLETE # noqa
20-
from b2._internal._utils.python_compat import removeprefix
2120

2221
AUTOCOMPLETE.autocomplete_from_cache()
2322

@@ -49,7 +48,7 @@
4948
from concurrent.futures import Executor, Future, ThreadPoolExecutor
5049
from contextlib import suppress
5150
from enum import Enum
52-
from typing import Any, BinaryIO, List
51+
from typing import Any, BinaryIO
5352

5453
import b2sdk
5554
import requests
@@ -782,7 +781,7 @@ def _setup_parser(cls, parser):
782781
super()._setup_parser(parser)
783782

784783
def get_b2_uri_from_arg(self, args: argparse.Namespace) -> B2URI:
785-
return B2URI(removeprefix(args.bucketName or '', 'b2://'), args.folderName or '')
784+
return B2URI((args.bucketName or '').removeprefix('b2://'), args.folderName or '')
786785

787786

788787
class B2IDOrB2URIMixin:
@@ -884,7 +883,7 @@ def _setup_parser(cls, parser):
884883
add_normalized_argument(
885884
lifecycle_group,
886885
'--lifecycle-rules',
887-
type=functools.partial(validated_loads, expected_type=List[LifecycleRule]),
886+
type=functools.partial(validated_loads, expected_type=list[LifecycleRule]),
888887
help='(deprecated; use --lifecycle-rule instead) List of lifecycle rules in JSON format.',
889888
)
890889

b2/_internal/version_listing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111
import pathlib
1212
import re
13-
from typing import List
1413

1514
RE_VERSION = re.compile(r'[_]*b2v(\d+)')
1615

1716

18-
def get_versions() -> List[str]:
17+
def get_versions() -> list[str]:
1918
return [path.name for path in sorted(pathlib.Path(__file__).parent.glob('*b2v*'))]
2019

2120

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use b2sdk pytest plugin and utilities in tests.

0 commit comments

Comments
 (0)