squirrel.integration_test.shared_fixtures

This module defines shared fixtures that can be used inside a conftest.py like this

from squirrel.integration_test.shared_fixtures import * # noqa: F401, F403

These fixtures will then be shared with the tests under the scope of the conftest.py.

This is useful for splitting unit and integration tests and defining separate conftest files. Specific fixtures for integration or unit tests can then be defined in the respective conftest.

Module Contents

Functions

array_shape() → SHAPE

Set the testing array shape.

keys() → List[str]

Define shards used in testing.

test_gcs_url() → str

Get the path for testing gcs bucket store. Change of gcs target location should be set here, instead of

test_path(request: pytest.FixtureRequest, tmp_path: squirrel.constants.URL, test_gcs_url: squirrel.constants.URL) → squirrel.constants.URL

Use parametrization in pytest to generate two paths consecutively. Any testing function and fixture

torch_mock(torch_worker: Tuple[int, int], torch_world: Tuple[int, int]) → unittest.mock.MagicMock

Returns a mock of the pytorch module with parallel and distributed worker.

torch_worker(request: pytest.FixtureRequest) → int

Pytorch worker config (worker_idx, num_worker).

torch_world(request: pytest.FixtureRequest) → int

Pytorch world config (rank_idx, world_size).