Skip to content

Commit

Permalink
Removed slicer test
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Semeraro committed Oct 28, 2021
1 parent 418cbec commit 84b6f4c
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions python/test/test_visualization.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
import unittest
import pumapy as puma
import numpy as np
import multiprocessing


def test_plot_slices():
ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
puma.plot_slices(ws)

def test_compare_slices():
ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
ws2 = ws.copy()
ws2.binarize_range((100, 255))
puma.compare_slices(ws, ws2)

def run_test(self_test, function):
p = multiprocessing.Process(target=function)
p.start()
p.join(3)

if p.is_alive():
print("Function executed for 3 seconds with no errors, this is a planned timeout.")
p.terminate()
p.join()
else:
print("Exception raised in detached process.")
# self_test.assertEqual(1, 0)

class TestSlicer(unittest.TestCase):

def test_plot_slices(self):
run_test(self, test_plot_slices)

def test_compare_slices(self):
run_test(self, test_compare_slices)
# the following works locally, but not on github workflow
# import multiprocessing
#
# def test_plot_slices():
# ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
# puma.plot_slices(ws)
#
# def test_compare_slices():
# ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
# ws2 = ws.copy()
# ws2.binarize_range((100, 255))
# puma.compare_slices(ws, ws2)
#
# def run_test(self_test, function):
# p = multiprocessing.Process(target=function)
# p.start()
# p.join(3)
#
# if p.is_alive():
# print("Function executed for 3 seconds with no errors, this is a planned timeout.")
# p.terminate()
# p.join()
# else:
# print("Exception raised in detached process.")
# # self_test.assertEqual(1, 0)
#
# class TestSlicer(unittest.TestCase):
#
# def test_plot_slices(self):
# run_test(self, test_plot_slices)
#
# def test_compare_slices(self):
# run_test(self, test_compare_slices)


class TestRender(unittest.TestCase):
Expand Down

0 comments on commit 84b6f4c

Please sign in to comment.