Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bucket to bucket sync #103

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
* Add support for Python 3.9
* Support for bucket to bucket sync

### Removed
Expand Down
4 changes: 2 additions & 2 deletions b2sdk/sync/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def sync_folders(self, source_folder, dest_folder, now_millis, reporter):
dest_type = dest_folder.folder_type()

if source_type != 'b2' and dest_type != 'b2':
raise NotImplementedError('Sync between two local folders is not supported!')
raise ValueError('Sync between two local folders is not supported!')

# For downloads, make sure that the target directory is there.
if dest_type == 'local' and not self.dry_run:
Expand Down Expand Up @@ -244,7 +244,7 @@ def make_folder_sync_actions(
dest_type = dest_folder.folder_type()
sync_type = '%s-to-%s' % (source_type, dest_type)
if source_type != 'b2' and dest_type != 'b2':
raise NotImplementedError('Sync between two local folders is not supported!')
raise ValueError('Sync between two local folders is not supported!')

total_files = 0
total_bytes = 0
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
PY_PATHS = ['b2sdk', 'test', 'noxfile.py', 'setup.py']

REQUIREMENTS_FORMAT = ['yapf==0.27']
REQUIREMENTS_LINT = ['yapf==0.27', 'pyflakes==2.2.0', 'pytest==6.0.1', 'liccheck==0.4.7']
REQUIREMENTS_TEST = ['nose==1.3.7', 'pytest==6.0.1', 'pytest-cov==2.10.0', 'pytest-mock==3.3.1']
REQUIREMENTS_LINT = ['yapf==0.27', 'pyflakes==2.2.0', 'pytest==6.1.1', 'liccheck==0.4.7']
REQUIREMENTS_TEST = ['pytest==6.1.1', 'pytest-cov==2.10.1', 'pytest-mock==3.3.1']
REQUIREMENTS_BUILD = ['setuptools>=20.2']

nox.options.reuse_existing_virtualenvs = True
Expand Down
14 changes: 8 additions & 6 deletions test/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@

pytest.register_assert_rewrite('test.unit')

API_VERSIONS = ['v0', 'v1']
mlech-reef marked this conversation as resolved.
Show resolved Hide resolved


@pytest.hookimpl
def pytest_addoption(parser):
parser.addoption(
'--api',
default='v1',
choices=['v0', 'v1'],
default=API_VERSIONS[-1],
choices=API_VERSIONS,
help='version of the API',
)

Expand All @@ -40,10 +42,10 @@ def pytest_report_header(config):
def pytest_ignore_collect(path, config):
path = str(path)
ver = config.getoption('--api')
if ver == 'v1' and 'v0' + os.sep in path:
return True
if ver == 'v0' and 'v1' + os.sep in path:
return True
other_versions = [v for v in API_VERSIONS if v != ver]
for other_version in other_versions:
if other_version + os.sep in path:
return True
return False


Expand Down
2 changes: 1 addition & 1 deletion test/unit/sync/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_illegal_args(self, synchronizer_factory, apiver, args):
synchronizer_factory(**args)

def test_illegal(self, synchronizer):
with pytest.raises(NotImplementedError):
with pytest.raises(ValueError):
src = self.local_folder_factory()
dst = self.local_folder_factory()
self.assert_folder_sync_actions(synchronizer, src, dst, [])
Expand Down
2 changes: 1 addition & 1 deletion test/unit/v1/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import threading
import time
import unittest
from nose import SkipTest
from enum import Enum
from unittest.mock import MagicMock

import pytest
Expand Down