Skip to content
Open
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
48 changes: 48 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,54 @@ pytest tests
```
For Windows systems, you may need to add `pytest` to PATH before executing the command.

#### Running Tests Against Local Services

The test suite can use a local OpenML service stack instead of the remote test server.
This requires Docker Desktop and the [`openml/services`](https://github.com/openml/services)
repository.

From the directory where you want to clone the services repository, run:

```bash
git clone --depth 1 https://github.com/openml/services.git
cd services
chmod -R a+rw ./data
chmod -R a+rw ./logs
docker compose --profile rest-api --profile minio --profile evaluation-engine up -d
```

The permission commands allow the containers to write their local data and logs.
Wait until the `openml-php-rest-api` container reports a healthy status before running
the tests. You can also verify the service gateway with:

```bash
curl -sSfL http://localhost:8000/api/v1/xml/data/1
```

In a second terminal, from the `openml-python` repository, enable local services and
run the tests:

```bash
# Linux/macOS
export OPENML_USE_LOCAL_SERVICES=true
pytest -n 4 --durations=20 --dist load -sv -m "not production_server"
```

On Windows PowerShell, use:

```powershell
$env:OPENML_USE_LOCAL_SERVICES = "true"
pytest -sv -m "not production_server"
```

The `OPENML_USE_LOCAL_SERVICES` variable must be set in the same terminal session
where pytest is started. To stop the local services after testing, run this from the
`services` repository:

```bash
docker compose --profile rest-api --profile minio --profile evaluation-engine down
```

Executing a specific unit test can be done by specifying the module, test case, and test.
You may then run a specific module, test case, or unit test respectively:
```bash
Expand Down
20 changes: 8 additions & 12 deletions docs/developer_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,31 @@ cd services

#### 2. Configure File Permissions

To ensure the containerized PHP service can write to the local filesystem, initialize the data directory permissions.

From the repository root:
To ensure the containers can write to the local filesystem, initialize the data and
log directory permissions from the services repository root:

```bash
chown -R www-data:www-data data/php
chmod -R a+rw ./data
chmod -R a+rw ./logs
```

If the `www-data` user does not exist on the host system, grant full permissions as a fallback:

```bash
chmod -R 777 data/php
```
These permissions are required before starting the Docker services.

#### 3. Launch Services

Initialize the container stack:

```bash
docker compose --profile all up -d
docker compose --profile rest-api --profile minio --profile evaluation-engine up -d
```

#### Warning: Container Conflicts

If API v2 (Python backend) containers are present on the system, name conflicts may occur. To resolve this, stop and remove existing containers before launching API v1:

```bash
docker compose --profile all down
docker compose --profile all up -d
docker compose --profile rest-api --profile minio --profile evaluation-engine down
docker compose --profile rest-api --profile minio --profile evaluation-engine up -d
```

#### 4. Verification
Expand Down