-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from pynbody/multiwin
Adding tests
- Loading branch information
Showing
11 changed files
with
251 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build and Test | ||
|
||
on: [push, pull_request] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
|
||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.10", "3.11"] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Install llvmpipe and lavapipe for offscreen canvas | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update -y -qq | ||
sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers | ||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/checkout@v2 | ||
- name: Install | ||
run: | | ||
pip install .[test] | ||
- name: Run all tests | ||
working-directory: tests | ||
run: python -m pytest | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: Outputs from tests on Python ${{ matrix.python-version }} | ||
path: tests/output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM ubuntu:latest | ||
|
||
|
||
RUN apt update && apt install -y python3 python3-pip libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev \ | ||
libglib2.0-0 mesa-vulkan-drivers libgl1-mesa-glx libxkbcommon0 libdbus-1-3 | ||
|
||
# manually install some dependencies to speed up | ||
RUN pip3 install numpy pynbody matplotlib pillow wgpu jupyter_rfb tqdm opencv-python PySide6 | ||
|
||
COPY src /app/src | ||
COPY tests /app/tests | ||
COPY pyproject.toml /app/ | ||
COPY README.md /app/ | ||
|
||
WORKDIR /app | ||
|
||
|
||
RUN pip3 install .[test] | ||
|
||
ENTRYPOINT ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
import numpy as np | ||
from wgpu.gui.offscreen import WgpuManualOffscreenCanvas, call_later | ||
|
||
from . import VisualizerCanvasBase | ||
|
||
from typing import TYPE_CHECKING | ||
if TYPE_CHECKING: | ||
from ..visualizer import Visualizer | ||
|
||
|
||
class VisualizerCanvas(VisualizerCanvasBase, WgpuManualOffscreenCanvas): | ||
|
||
@classmethod | ||
def call_later(cls, delay, fn, *args): | ||
call_later(delay, fn, *args) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# It may be useful to run the tests in docker to track down issues using a standardised environment | ||
# This script will build the docker image, run the tests and copy the output to the local machine | ||
|
||
rm -rf docker_test_output | ||
docker build .. -t topsy | ||
docker run --name running-tests topsy -c 'pytest' | ||
docker cp running-tests:/app/tests/output ./docker_test_output | ||
docker rm running-tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.