Skip to content
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
494 changes: 3 additions & 491 deletions tests/conftest.py

Large diffs are not rendered by default.

Empty file added tests/fixtures/__init__.py
Empty file.
504 changes: 504 additions & 0 deletions tests/fixtures/files.py

Large diffs are not rendered by default.

File renamed without changes.
9 changes: 7 additions & 2 deletions tests/s3_fixtures.py → tests/fixtures/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# From: https://github.com/dask/s3fs/blob/ffe3a5293524869df56e74973af0d2c204ae9cbf/s3fs/tests/test_s3fs.py#L25-L141

s3_test_bucket_name = "test"
S3_TEST_BUCKET_NAME = "test"
s3_port = 5555
s3_endpoint_uri = f"http://127.0.0.1:{s3_port}/"

Expand All @@ -19,6 +19,11 @@
}


@pytest.fixture(scope="session")
def s3_test_bucket_name():
return S3_TEST_BUCKET_NAME


@pytest.fixture()
def s3_base():
# writable local S3 system
Expand Down Expand Up @@ -57,7 +62,7 @@ def get_boto3_client():


@pytest.fixture()
def s3(s3_base):
def s3(s3_base, s3_test_bucket_name):
client = get_boto3_client()
client.create_bucket(Bucket=s3_test_bucket_name, ACL="public-read")

Expand Down
3 changes: 1 addition & 2 deletions tests/test_arrow_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
from datasets.utils.logging import WARNING
from datasets.utils.py_utils import temp_seed

from .conftest import s3_test_bucket_name
from .utils import (
assert_arrow_memory_doesnt_increase,
assert_arrow_memory_increases,
Expand Down Expand Up @@ -3123,7 +3122,7 @@ def test_pickle_dataset_after_transforming_the_table(in_memory, method_and_param
reason='On Windows CircleCI or GitHub Actions, it raises botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:5555/test"',
) # TODO: find what's wrong with CircleCI / GitHub Actions
@require_s3
def test_dummy_dataset_serialize_s3(s3, dataset):
def test_dummy_dataset_serialize_s3(s3, dataset, s3_test_bucket_name):
mock_bucket = s3_test_bucket_name
dataset_path = f"s3://{mock_bucket}/my_dataset"
features = dataset.features
Expand Down
3 changes: 1 addition & 2 deletions tests/test_dataset_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from datasets.features import ClassLabel, Features, Sequence, Value
from datasets.splits import NamedSplit

from .conftest import s3_test_bucket_name
from .utils import (
assert_arrow_memory_doesnt_increase,
assert_arrow_memory_increases,
Expand Down Expand Up @@ -669,7 +668,7 @@ def test_datasetdict_from_text_split(split, text_path, tmp_path):
reason='On Windows CircleCI or GitHub Actions, it raises botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:5555/test"',
) # TODO: find what's wrong with CircleCI / GitHub Actions
@require_s3
def test_dummy_dataset_serialize_s3(s3, dataset):
def test_dummy_dataset_serialize_s3(s3, dataset, s3_test_bucket_name):
dsets = DatasetDict({"train": dataset, "test": dataset.select(range(2))})
mock_bucket = s3_test_bucket_name
dataset_path = f"s3://{mock_bucket}/datasets/dict"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_upstream_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from datasets import Audio, ClassLabel, Dataset, DatasetDict, Features, Image, Value, load_dataset
from datasets.utils._hf_hub_fixes import delete_repo
from tests.hub_fixtures import ENDPOINT_STAGING, TOKEN, USER
from tests.fixtures.hub import ENDPOINT_STAGING, TOKEN, USER
from tests.utils import require_pil, require_sndfile


Expand Down