Skip to content

Commit

Permalink
Testing: Run tests with Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Nov 21, 2020
1 parent d07bfc9 commit b7589d1
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/linux-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Linux tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
linux:
name: Linux Py${{ matrix.PYTHON_VERSION }}
runs-on: ubuntu-latest
env:
CI: True
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
RUNNER_OS: 'ubuntu'
COVERALLS_REPO_TOKEN: XWVhJf2AsO7iouBLuCsh0pPhwHy81Uz1v
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.6', '3.7', '3.8']
steps:
- name: Checkout branch
uses: actions/checkout@v1
- name: Install System Packages
run: |
sudo apt-get update
sudo apt-get install libegl1-mesa
- name: Install Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
- name: Install dependencies
shell: bash -l {0}
run: conda env update --file requirements/environment.yml
- name: Show environment information
shell: bash -l {0}
run: |
conda info
conda list
- name: Run tests
shell: bash -l {0}
run: xvfb-run --auto-servernum pytest -x -vv --cov=qtconsole qtconsole
- name: Upload coverage to Codecov
if: matrix.PYTHON_VERSION == '3.8'
shell: bash -l {0}
run: coveralls
43 changes: 43 additions & 0 deletions .github/workflows/macos-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Macos tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
macos:
name: Mac Py${{ matrix.PYTHON_VERSION }}
runs-on: macos-latest
env:
CI: True
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
RUNNER_OS: 'macos'
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.6', '3.7', '3.8']
steps:
- name: Checkout branch
uses: actions/checkout@v1
- name: Install Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
- name: Install package dependencies
shell: bash -l {0}
run: conda env update --file requirements/environment.yml
- name: Show environment information
shell: bash -l {0}
run: |
conda info
conda list
- name: Run tests
shell: bash -l {0}
run: pytest -x -vv --cov=qtconsole qtconsole
43 changes: 43 additions & 0 deletions .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Windows tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
windows:
name: Windows Py${{ matrix.PYTHON_VERSION }}
runs-on: windows-latest
env:
CI: True
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
RUNNER_OS: 'windows'
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.6', '3.7', '3.8']
steps:
- name: Checkout branch
uses: actions/checkout@v1
- name: Install Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
- name: Install package dependencies
shell: bash -l {0}
run: conda env update --file requirements/environment.yml
- name: Show environment information
shell: bash -l {0}
run: |
conda info
conda list
- name: Run tests
shell: bash -l {0}
run: pytest -x -vv --cov=qtconsole qtconsole
2 changes: 2 additions & 0 deletions qtconsole/tests/test_00_console_widget.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest
import sys

from flaky import flaky
import pytest
Expand Down Expand Up @@ -354,6 +355,7 @@ def test_select_all(self):
copied = app.clipboard().text()
self.assertEqual(copied, 'Header\nprompt>if:\n> pass')

@pytest.mark.skipif(sys.platform == 'darwin', reason="Fails on macOS")
def test_keypresses(self):
"""Test the event handling code for keypresses."""
w = ConsoleWidget()
Expand Down
4 changes: 3 additions & 1 deletion qtconsole/tests/test_jupyter_widget.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import unittest

import pytest

from qtpy import QtWidgets

from qtconsole.client import QtKernelClient
from qtconsole.jupyter_widget import JupyterWidget
from . import no_display
Expand Down Expand Up @@ -39,6 +40,7 @@ def test_stylesheet_changed(self):
w.syntax_style = 'monokai'
self.assertEqual(w._ansi_processor.get_color(15).name(), '#ffffff')

@pytest.mark.skipif(os.name == 'nt', reason="Fails on Windows")
def test_other_output(self):
""" Test displaying output from other clients.
"""
Expand Down
21 changes: 21 additions & 0 deletions requirements/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
channels:
- defaults
- spyder-ide
dependencies:
# Main dependencies
- pyqt
- qtpy
- traitlets
- ipython_genutils
- jupyter_core
- jupyter_client
- pygments
- ipykernel
- pyzmq >=17.1

# For testing
- coveralls
- flaky
- pytest
- pytest-cov
- pytest-qt

0 comments on commit b7589d1

Please sign in to comment.