Fix broken test test_gcp_disk_tier
(#5393)
#22145
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Tests | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- master | |
- 'releases/**' | |
pull_request: | |
branches: | |
- master | |
- 'releases/**' | |
merge_group: | |
jobs: | |
python-test: | |
strategy: | |
matrix: | |
python-version: ["3.8"] | |
test-path: | |
- tests/unit_tests | |
- tests/test_api.py | |
- tests/test_cli.py | |
- tests/test_config.py | |
- tests/test_global_user_state.py | |
- tests/test_jobs.py | |
- tests/test_list_accelerators.py | |
- tests/test_optimizer_dryruns.py | |
- tests/test_optimizer_random_dag.py | |
- tests/test_storage.py | |
- tests/test_wheels.py | |
- tests/test_jobs_and_serve.py | |
- tests/test_yaml_parser.py | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
version: "latest" | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
uv venv --seed ~/test-env | |
source ~/test-env/bin/activate | |
uv pip install --prerelease=allow "azure-cli>=2.65.0" | |
# Use -e to include examples and tests folder in the path for unit | |
# tests to access them. | |
uv pip install -e ".[all]" | |
uv pip install pytest pytest-xdist pytest-env>=0.6 pytest-asyncio memory-profiler==0.61.0 | |
- name: Run tests with pytest | |
run: | | |
source ~/test-env/bin/activate | |
SKYPILOT_DISABLE_USAGE_COLLECTION=1 SKYPILOT_SKIP_CLOUD_IDENTITY_CHECK=1 pytest -n 0 --dist no ${{ matrix.test-path }} | |
limited-deps-test: | |
# Test with limited dependencies to ensure cloud module imports don't break | |
# basic functionality (e.g., importing IBM shouldn't break AWS support) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8"] | |
test-path: | |
- tests/test_cli.py | |
- tests/test_jobs_and_serve.py | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
version: "latest" | |
python-version: ${{ matrix.python-version }} | |
- name: Install limited dependencies | |
run: | | |
uv venv --seed ~/test-env | |
source ~/test-env/bin/activate | |
uv pip install --prerelease=allow "azure-cli>=2.65.0" | |
# Install limited dependencies only | |
uv pip install -e ".[kubernetes,aws,gcp,azure]" | |
uv pip install pytest pytest-xdist pytest-env>=0.6 pytest-asyncio memory-profiler==0.61.0 | |
- name: Run tests with pytest | |
run: | | |
source ~/test-env/bin/activate | |
SKYPILOT_DISABLE_USAGE_COLLECTION=1 SKYPILOT_SKIP_CLOUD_IDENTITY_CHECK=1 pytest -n 0 --dist no ${{ matrix.test-path }} | |
failover-test: | |
# Test failover functionality | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# moto requires >=3.9 | |
python-version: ["3.10"] | |
test-path: | |
- tests/test_failover.py | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
version: "latest" | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
uv venv --seed ~/test-env | |
source ~/test-env/bin/activate | |
uv pip install --prerelease=allow "azure-cli>=2.65.0" | |
# Use -e to include examples and tests folder in the path for unit | |
# tests to access them. | |
uv pip install -e ".[all]" | |
uv pip install pytest pytest-xdist pytest-env>=0.6 pytest-asyncio memory-profiler==0.61.0 moto==5.1.2 | |
- name: Run tests with pytest | |
run: | | |
source ~/test-env/bin/activate | |
SKYPILOT_DISABLE_USAGE_COLLECTION=1 SKYPILOT_SKIP_CLOUD_IDENTITY_CHECK=1 pytest -n 0 --dist no ${{ matrix.test-path }} |