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

Follow up for split integrations #5277

Merged
merged 10 commits into from
Mar 4, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
62 changes: 0 additions & 62 deletions .github/workflows/checks-integration.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:

pip install --progress-bar off .[test]
pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu
pip install --progress-bar off .[integration] --extra-index-url https://download.pytorch.org/whl/cpu

echo 'import coverage; coverage.process_startup()' > sitecustomize.py

Expand Down
66 changes: 3 additions & 63 deletions .github/workflows/mac-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Run tests and integration tests on Mac, which are triggered by each master push.
# Run tests on Mac, which are triggered by each master push.
# Currently, Python3.8 is only used as an environment.
# This is mainly for the sake of speed.
name: mac-tests
Expand Down Expand Up @@ -64,68 +64,8 @@ jobs:
- name: Scheduled tests
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
pytest tests -m "not integration"
pytest tests
- name: Tests
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }}
run: |
pytest tests -m "not integration and not slow"


tests-integration-mac:
runs-on: macos-latest

# Scheduled Tests are disabled for forks.
if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule')
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Setup cache
uses: actions/cache@v3
env:
cache-name: test-integration
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-3.8-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1
restore-keys: |
${{ runner.os }}-3.8-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}

- name: Setup mac environment
run: |
brew install libomp
brew install open-mpi
brew install openblas

- name: Install
run: |
python -m pip install --upgrade pip

# Install minimal dependencies and confirm that `import optuna` is successful.
pip install --progress-bar off .
python -c 'import optuna'
optuna --version

pip install --progress-bar off .[test]
pip install --progress-bar off .[optional]
pip install --progress-bar off .[integration]

- name: Output installed packages
run: |
pip freeze --all
- name: Output dependency tree
run: |
pip install pipdeptree
pipdeptree


- name: Tests
run: |
pytest tests -m "integration"

env:
OMP_NUM_THREADS: 1
pytest tests -m "not slow"
85 changes: 0 additions & 85 deletions .github/workflows/tests-integration.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/tests-with-minimum-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ jobs:
- name: Scheduled tests
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
pytest tests -m "not integration"
pytest tests

- name: Tests
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }}
run: |
pytest tests -m "not integration and not slow"
pytest tests -m "not slow"
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ jobs:
run: |
if [ "${{ github.event_name }}" = "schedule" ] || \
[ "${{ github.event_name }}" = "workflow_dispatch" ] ; then
target="not integration"
target=""
else
target="not integration and not slow"
target="not slow"
fi

if [ "${{ matrix.python-version }}" = "3.12" ] ; then
Expand Down
64 changes: 3 additions & 61 deletions .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Run tests and integration tests on Windows, which are triggered by each master push.
# Run tests on Windows, which are triggered by each master push.
# Currently, Python3.9 is only used as an environment.
# This is mainly for the sake of speed.
name: windows-tests
Expand Down Expand Up @@ -65,72 +65,14 @@ jobs:
- name: Scheduled tests
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
pytest -m "not integration"
pytest
env:
SQLALCHEMY_WARN_20: 1
MPLBACKEND: "QtAgg" # Use QtAgg as matplotlib backend.

- name: Tests
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }}
run: |
pytest -m "not integration and not slow"
pytest -m "not slow"
env:
MPLBACKEND: "QtAgg" # Use QtAgg as matplotlib backend.

tests-integration-windows:
runs-on: windows-latest

# Not intended for forks.
if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule')
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Setup cache
uses: actions/cache@v3
env:
cache-name: windows-test-integration
with:
path: ~\\AppData\\Local\\pip\\Cache
key: ${{ runner.os }}-3.9-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1
restore-keys: |
${{ runner.os }}-3.9-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}

- name: Setup MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: "msmpi"

- name: Install
run: |
python -m pip install --upgrade pip
pip install --progress-bar off -U setuptools
# Install minimal dependencies and confirm that `import optuna` is successful.
pip install --progress-bar off .
python -c 'import optuna'
optuna --version
pip install --progress-bar off .[test]
pip install --progress-bar off .[optional]
pip install --progress-bar off .[integration]
pip install "distributed<2023.3.2"

- name: Output installed packages
run: |
pip freeze --all
- name: Output dependency tree
run: |
pip install pipdeptree
pipdeptree

- name: Tests
# Skip allennlp tests since it's not supported on Windows.
run: |
pytest tests -m "integration" `
--ignore tests/integration_tests/allennlp_tests/test_allennlp.py `
env:
OMP_NUM_THREADS: 1
8 changes: 1 addition & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,8 @@ unit tests are stored under the [tests directory](./tests).

Please install some required packages at first.
```bash
# Install required packages to test all modules without integration modules.
# Install required packages to test all modules.
pip install ".[test,optional]"

# Install required packages to test all modules including integration modules.
pip install ".[integration]" -f https://download.pytorch.org/whl/torch_stable.html
```

You can run your tests as follows:
Expand All @@ -152,9 +149,6 @@ You can run your tests as follows:
# Run all the unit tests.
pytest

# Run all the unit tests without integrations.
pytest -m "not integration"

# Run all the unit tests defined in the specified test file.
pytest tests/${TARGET_TEST_FILE_NAME}

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY . .
ARG BUILD_TYPE='dev'

RUN if [ "${BUILD_TYPE}" = "dev" ]; then \
pip install ${PIP_OPTIONS} -e '.[benchmark, checking, document, integration, optional, test]' --extra-index-url https://download.pytorch.org/whl/cpu; \
pip install ${PIP_OPTIONS} -e '.[benchmark, checking, document, optional, test]' --extra-index-url https://download.pytorch.org/whl/cpu; \
else \
pip install ${PIP_OPTIONS} -e .; \
fi \
Expand Down
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ document = [
"torch",
"torchvision",
]
integration = [
"scikit-learn>=0.24.2",
"shap",
"tensorflow",
]
optional = [
"boto3", # optuna/artifacts/_boto3.py.
"cmaes>=0.10.0", # optuna/samplers/_cmaes.py.
Expand Down Expand Up @@ -168,5 +163,4 @@ filterwarnings = 'ignore::optuna.exceptions.ExperimentalWarning'
markers = [
"skip_coverage: marks tests are skipped when calculating the coverage",
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests are related to integration",
]
Empty file.