Python: skip redis tests in CI if the platform is not linux (#2727)

### Motivation and Context
The python integration tests use the public redis docker image. This
image is not available to our macOS and windows test agents. This PR
ensures that the tests are skipped on non-linux platforms (CI only).

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
This commit is contained in:
Abby Harrison
2023-09-05 23:46:20 +00:00
committed by GitHub
parent 72736904ca
commit 393277bf8f
2 changed files with 15 additions and 2 deletions
@@ -91,7 +91,10 @@ jobs:
AZURE_COGNITIVE_SEARCH_ADMIN_KEY: ${{secrets.AZURE_COGNITIVE_SEARCH_ADMIN_KEY}}
AZURE_COGNITIVE_SEARCH_ENDPOINT: ${{secrets.AZURE_COGNITIVE_SEARCH_ENDPOINT}}
run: |
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
if ${{ matrix.os == 'ubuntu-latest' }}; then
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
fi
cd python
poetry run pytest ./tests/integration -v
@@ -150,7 +153,10 @@ jobs:
AZURE_COGNITIVE_SEARCH_ADMIN_KEY: ${{secrets.AZURE_COGNITIVE_SEARCH_ADMIN_KEY}}
AZURE_COGNITIVE_SEARCH_ENDPOINT: ${{secrets.AZURE_COGNITIVE_SEARCH_ENDPOINT}}
run: |
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
if ${{ matrix.os == 'ubuntu-latest' }}; then
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
fi
cd python
poetry run pytest ./tests/integration -v
@@ -1,6 +1,8 @@
# Copyright (c) Microsoft. All rights reserved.
import asyncio
import os
import platform
from datetime import datetime
import numpy as np
@@ -21,6 +23,11 @@ except ImportError:
pytestmark = pytest.mark.skipif(not redis_installed, reason="Redis is not installed")
pytestmark = pytest.mark.skipif(
platform.system() != "Linux" and "Python_Integration_Tests" in os.environ,
reason="local redis docker container is not available on all non-Linux platforms",
)
@pytest.fixture(scope="session")
def connection_string():