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

Use pytest instead of parameterizedtestcase #657

Merged
merged 3 commits into from
Oct 10, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -1,5 +1,7 @@
# Unreleased

- Use pytest instead of parameterizedtestcase (PR [#657](https://github.com/RaRe-Technologies/smart_open/pull/657), [@mpenkov](https://github.com/mpenkov))

# 5.2.1, 28 August 2021

- make HTTP/S seeking less strict (PR [#646](https://github.com/RaRe-Technologies/smart_open/pull/646), [@mpenkov](https://github.com/mpenkov))
Expand Down
20 changes: 13 additions & 7 deletions integration-tests/test_s3_ported.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import warnings

import boto3
from parameterizedtestcase import ParameterizedTestCase as PTestCase
import pytest

import smart_open
import smart_open.concurrency
Expand Down Expand Up @@ -277,7 +277,7 @@ def force(multiprocessing=False, concurrent_futures=False):
smart_open.concurrency._CONCURRENT_FUTURES = old_concurrent_futures


class IterBucketTest(PTestCase):
class IterBucketTest(unittest.TestCase):
def setUp(self):
self.expected = [
(key, value)
Expand Down Expand Up @@ -321,11 +321,17 @@ def test_accept_key(self):
self.assertEqual(len(expected), len(actual))
self.assertEqual(expected, sorted(actual))

@PTestCase.parameterize(('workers',), [(x,) for x in (1, 4, 8, 16, 64)])
def test_workers(self, workers):
actual = list(smart_open.s3.iter_bucket(BUCKET_NAME, prefix='iter_bucket', workers=workers))
self.assertEqual(len(self.expected), len(actual))
self.assertEqual(self.expected, sorted(actual))

@pytest.mark.parametrize('workers', [(x,) for x in (1, 4, 8, 16, 64)])
def test_workers(self, workers):
expected = sorted([
(key, value)
for (key, value) in CONTENTS.items()
if key.startswith('iter_bucket/')
])
actual = sorted(smart_open.s3.iter_bucket(BUCKET_NAME, prefix='iter_bucket', workers=workers))
assert len(self.expected) == len(actual)
assert expected == actual


class DownloadKeyTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def _get_version():
def read(fname):
return io.open(os.path.join(os.path.dirname(__file__), fname), encoding='utf-8').read()


aws_deps = ['boto3']
gcs_deps = ['google-cloud-storage']
azure_deps = ['azure-storage-blob', 'azure-common', 'azure-core']
Expand All @@ -47,7 +48,6 @@ def read(fname):
'responses',
'boto3',
'paramiko',
'parameterizedtestcase',
'pytest',
'pytest-rerunfailures'
]
Expand Down
Loading