Skip to content

Commit

Permalink
added travis ci and basic testing
Browse files Browse the repository at this point in the history
  • Loading branch information
akaszynski committed Jul 6, 2018
1 parent 9c6b429 commit da4ca2d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sudo: false
language: python
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"

# install dependencies
install:
- pip install -r requirements.txt

# run tests
script:
- python -m pytest
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy
imageio
vtk
15 changes: 15 additions & 0 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import vtkInterface as vtki
from vtkInterface import examples

def RunningXServer():
""" Check if x server is running """
if os.name != 'posix': # linux or mac os
raise Exception('Can only check x server on POSIX')
p = Popen(["xset", "-q"], stdout=PIPE, stderr=PIPE)
p.communicate()
return p.returncode == 0

# we're getting there
# def test_offscreen():
# sphere = examples.LoadSphere()
# sphere.Plot(off_screen=True)
16 changes: 16 additions & 0 deletions tests/test_polydata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import numpy as np
import vtkInterface as vtki
from vtkInterface import examples
spherefile = examples.spherefile

class TestPolyData(object):
# sphere = vtki.PolyData(spherefile)

def test_loadfromfile(self):
sphere = vtki.PolyData(spherefile)
assert sphere.GetNumberOfPoints()
assert sphere.GetNumberOfCells()
assert hasattr(sphere, 'points')

# self = TestPolyData()
# self.test_loadfromfile()
2 changes: 1 addition & 1 deletion vtkInterface/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from subprocess import Popen, PIPE

import os
from multiprocessing import Process
import colorsys
import numpy as np
Expand Down

0 comments on commit da4ca2d

Please sign in to comment.