Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:
# schedule:
# - cron: '42 5 * * *'

jobs:
test:
strategy:
fail-fast: false
matrix:
runner: [ubuntu-latest, macos-latest] #, windows-latest]
python-version: ["3.9", "3.10", "3.11"]

runs-on: ${{matrix.runner}}
name: OS ${{matrix.runner}} Python ${{matrix.python-version}}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python setup.py build
pip install pytest

- name: Check Python version
run: python -V

- name: Test with pytest
run: pytest -vvs tests/

19 changes: 19 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import subprocess
import os
import sys

def capture(command):
proc = subprocess.Popen(command,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
)
out, err = proc.communicate()
exit_code = proc.returncode
return exit_code, out.decode('utf-8'), err.decode('utf-8')

def test_test():
os.environ["PYTHONPATH"] = "."
exit_code, out, err = capture([sys.executable, "examples/test.py"])
assert exit_code == 0
assert out == "test1\ntest2\n"
assert err == ""