Skip to content

Commit

Permalink
CI: use pytest (#56) (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mainakdeb authored May 4, 2021
1 parent d7f0398 commit a819c90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ dist: bionic
install:
- pip install .
- pip install -r requirements.txt
- pip install pytest
script:
- python setup.py test
- pytest devolearn/tests/test.py
9 changes: 6 additions & 3 deletions devolearn/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
import matplotlib.pyplot as plt
import os
import pytest

import warnings
warnings.filterwarnings("ignore")
Expand All @@ -17,6 +18,7 @@

class test(unittest.TestCase):

@pytest.mark.lineage_population_model
def test_lineage_population_model(self):
test_dir = os.path.dirname(__file__)

Expand All @@ -29,15 +31,17 @@ def test_lineage_population_model(self):

plot = model.create_population_plot_from_video(video_path = test_dir + "/" + "sample_data/videos/embryo_timelapse.mov", save_plot= False, plot_name= "sample_preds/plot.png", ignore_last_n_frames= 0 )
self.assertTrue(isinstance(plot, type(plt)), "should be matplotlib.pyplot")


@pytest.mark.embryo_generator_model
def test_embryo_generator_model(self):
test_dir = os.path.dirname(__file__)

generator = embryo_generator_model()
gen_image = generator.generate() ## 2d numpy array
self.assertTrue(isinstance(gen_image, np.ndarray), "should be dict")
self.assertTrue(isinstance(generator.generate_n_images(n = 1, foldername= test_dir + "/" + "generated_images", image_size= (700,500)), type(None)), "should return None without errors")


@pytest.mark.embryo_segmentor
def test_embryo_segmentor(self):
test_dir = os.path.dirname(__file__)

Expand All @@ -55,7 +59,6 @@ def test_embryo_segmentor(self):
centroid_df = segmentor.predict_from_video(video_path = test_dir + "/" + "sample_data/videos/seg_sample.mov", centroid_mode = True, save_folder = test_dir + "/" + "preds")
self.assertTrue(isinstance(centroid_df, pd.DataFrame), "should be a pandas.DataFrame")


if __name__ == '__main__':

unittest.main()

0 comments on commit a819c90

Please sign in to comment.