Skip to content

Commit

Permalink
Python CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
harveymmaunders committed Jan 9, 2025
1 parent 7d1c6b3 commit 33097f8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 62 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/python-ci.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Python Tests

on:
pull_request:
branches:
- main
jobs:
python-checkout-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
working-directory:
- ./client-samples/python/rest
- ./client-samples/python/websockets
defaults:
run:
working-directory: ${{ matrix.working-directory }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run pytest
run: pytest tests/
- name: Run black check (linting)
run: black --check .
9 changes: 1 addition & 8 deletions client-samples/python/websockets/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

from client import load_config, get_proxies
from test_consts import MOCK_CONFIG

TEST_PROXY_HOST = MOCK_CONFIG["proxy_host"]
TEST_PROXY_PORT = MOCK_CONFIG["proxy_port"]
TEST_PROXY_CONFIG = {
"http": f"{TEST_PROXY_HOST}:{TEST_PROXY_PORT}",
"https": f"{TEST_PROXY_HOST}:{TEST_PROXY_PORT}",
}
from test_consts import MOCK_CONFIG, TEST_PROXY_CONFIG


class TestConfigSetup(unittest.TestCase):
Expand Down
7 changes: 7 additions & 0 deletions client-samples/python/websockets/tests/test_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
"url": "HTTP://URL/",
"retry_bad_handshake_status": True,
}

TEST_PROXY_HOST = MOCK_CONFIG["proxy_host"]
TEST_PROXY_PORT = MOCK_CONFIG["proxy_port"]
TEST_PROXY_CONFIG = {
"http": f"{TEST_PROXY_HOST}:{TEST_PROXY_PORT}",
"https": f"{TEST_PROXY_HOST}:{TEST_PROXY_PORT}",
}

0 comments on commit 33097f8

Please sign in to comment.