This directory contains unit tests and integration tests for each of the python package interfaces we provide to access AIStore, including the Amazon S3 botocore, SDK, and PyTorch datasets APIs. It also contains tests for verifying s3 compatibility.
Before running the tests, install Python and set up your environment (venv, pyenv, conda, etc.).
The below instructions assume python will execute the correct version of Python.
Next, with your environment active, from the aistore/python directory install the dependencies for the tests you want
to run:
For all packages:
pip install -r aistore/common_requirements
For botocore patch tests:
pip install -r aistore/botocore_patch/botocore_requirements
For pytorch tests:
pip install -r aistore/pytorch/dev_requirements
Integration tests require a running AIS cluster.
This can be specified with the environment variable AIS ENDPOINT or will default to http://localhost:8080.
Note that any tests of etl functionality require the AIS cluster to be running in kubernetes.
These tests can be skipped using the pytest ignore option, e.g. --ignore=tests/integration/sdk/test_etl_ops.py
To run tests that expect a remote bucket, e.g. testing eviction of an object stored in s3, the BUCKET
environment variable must be set; otherwise these tests will be skipped.
All tests should support running on all operating systems, given access to a working AIS cluster.
Because of the way our botocore patch works, simply running pytest on the entire test directory will fail those tests. See the botocore test README for more info
Below are the recommended commands for running the test suites. Run these commands from the aistore/python directory.
python -m pytest tests/unit/sdk tests/integration/sdk
python -m pytest tests/integration/sdk -m "not etl"
python -m pytest tests/integration/sdk -m etl
python -m pytest tests/unit/sdk
-
Set the variable for number of tests
$BOTO_UNIT_TEST_COUNT = Get-ChildItem -Path "tests/unit/botocore_patch" -Filter "test*.py" | Measure-Object | Select-Object -ExpandProperty CountBOTO_UNIT_TEST_COUNT=$(ls -1 tests/unit/botocore_patch/test*py | wc -l) -
Run pytest with the xdist plugin to ensure each test runs separately
python -m pytest -v -n $BOTO_UNIT_TEST_COUNT --dist loadfile tests/unit/botocore_patch/
python -m pytest tests/integration/botocore_patch
python -m pytest tests/integration/pytorch
Currently, we have 2 separate tests for AIS S3 compatibility.
There is our own suite of tests, located in tests/integration/boto3. It can be run with
python -m pytest -v tests/integration/boto3
s3compat contains a modified version of the s3 tests from the Minio Python SDK, see the README for details.
