Skip to content

Commit

Permalink
Merge pull request #18 from RizkyRajitha/add-ghaction
Browse files Browse the repository at this point in the history
Add github action with trivial test cases with pytest
  • Loading branch information
J0 authored Sep 13, 2022
2 parents d475aea + 966f986 commit b787354
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI (Python)

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache Pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Test with Pytest
env:
SUPABASE_ID: ${{ secrets.SUPABASE_ID }}
API_KEY: ${{ secrets.API_KEY }}
run: poetry run pytest
305 changes: 305 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ authors = ["Joel"]

[tool.poetry.dependencies]
python = "^3.7"
dataclasses = "^0.6"
websockets = "^10.3"
python-dateutil = "^2.8.1"
typing-extensions = "^4.2.0"

[tool.poetry.dev-dependencies]
pytest = "^6.2.5"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
16 changes: 16 additions & 0 deletions tests/type_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
from realtime_py.connection import Socket

def getSock():
SUPABASE_ID = os.getenv("SUPABASE_ID")
API_KEY = os.getenv("API_KEY")

URL = f"wss://{SUPABASE_ID}.supabase.co/realtime/v1/websocket?apikey={API_KEY}&vsn=1.0.0"
s = Socket(URL)
s.connect()

return s

def test():
sock = getSock()
assert isinstance(sock , Socket) == True

0 comments on commit b787354

Please sign in to comment.