fury
fury copied to clipboard
Windows 10 issues after 0.6.1 release
====================================================== FAILURES =======================================================
______________________________________________________ test_grid ______________________________________________________
_interactive = False
def test_grid(_interactive=False):
vol1 = np.zeros((100, 100, 100))
vol1[25:75, 25:75, 25:75] = 100
contour_actor1 = actor.contour_from_roi(vol1, np.eye(4),
(1., 0, 0), 1.)
vol2 = np.zeros((100, 100, 100))
vol2[25:75, 25:75, 25:75] = 100
contour_actor2 = actor.contour_from_roi(vol2, np.eye(4),
(1., 0.5, 0), 1.)
vol3 = np.zeros((100, 100, 100))
vol3[25:75, 25:75, 25:75] = 100
contour_actor3 = actor.contour_from_roi(vol3, np.eye(4),
(1., 0.5, 0.5), 1.)
scene = window.Scene()
actors = []
texts = []
actors.append(contour_actor1)
text_actor1 = actor.text_3d('cube 1', justification='center')
texts.append(text_actor1)
actors.append(contour_actor2)
text_actor2 = actor.text_3d('cube 2', justification='center')
texts.append(text_actor2)
actors.append(contour_actor3)
text_actor3 = actor.text_3d('cube 3', justification='center')
texts.append(text_actor3)
actors.append(shallow_copy(contour_actor1))
text_actor1 = 'cube 4'
texts.append(text_actor1)
actors.append(shallow_copy(contour_actor2))
text_actor2 = 'cube 5'
texts.append(text_actor2)
actors.append(shallow_copy(contour_actor3))
text_actor3 = 'cube 6'
texts.append(text_actor3)
# show the grid without the captions
container = grid(actors=actors, captions=None,
caption_offset=(0, -40, 0),
cell_padding=(10, 10), dim=(2, 3))
scene.add(container)
scene.projection('orthogonal')
counter = itertools.count()
show_m = window.ShowManager(scene)
show_m.initialize()
def timer_callback(_obj, _event):
cnt = next(counter)
# show_m.scene.zoom(1)
show_m.render()
if cnt == 4:
show_m.exit()
show_m.destroy_timers()
show_m.add_timer_callback(True, 200, timer_callback)
show_m.start()
arr = window.snapshot(scene)
report = window.analyze_snapshot(arr)
> npt.assert_equal(report.objects, 6)
E AssertionError:
E Items are not equal:
E ACTUAL: 10
E DESIRED: 6
tests\test_actors.py:1154: AssertionError
_______________________________________________ test_matplotlib_figure ________________________________________________
@pytest.mark.skipif(not have_matplotlib, reason="Requires MatplotLib")
def test_matplotlib_figure():
names = ['group_a', 'group_b', 'group_c']
values = [1, 10, 100]
fig = plt.figure(figsize=(9, 3))
plt.subplot(131)
plt.bar(names, values)
plt.subplot(132)
plt.scatter(names, values)
plt.subplot(133)
plt.plot(names, values)
plt.suptitle('Categorical Plotting')
arr = matplotlib_figure_to_numpy(fig, dpi=500, transparent=True)
fig_actor = actor.figure(arr, 'cubic')
fig_actor2 = actor.figure(arr, 'cubic')
scene = window.Scene()
scene.background((1, 1, 1.))
ax_actor = actor.axes(scale=(1000, 1000, 1000))
scene.add(ax_actor)
scene.add(fig_actor)
scene.add(fig_actor2)
ax_actor.SetPosition(0, 500, -800)
fig_actor2.SetPosition(500, 800, -400)
display = window.snapshot(scene, 'test_mpl.png', order_transparent=False,
offscreen=True)
res = window.analyze_snapshot(display, bg_color=(255, 255, 255.),
colors=[(31, 119, 180), (255, 0, 0)],
find_objects=False)
> npt.assert_equal(res.colors_found, [True, True])
E AssertionError:
E Items are not equal:
E item=1
E
E ACTUAL: False
E DESIRED: True
test_clear_and_catch_warnings is also failing for me in windows 10 along with test_grid and test_matplotlib_figure.
________________________ test_clear_and_catch_warnings ________________________
def test_clear_and_catch_warnings():
# Initial state of module, no warnings
my_mod = sys.modules[__name__]
try:
my_mod.__warningregistry__.clear()
except AttributeError:
pass
npt.assert_equal(getattr(my_mod, '__warningregistry__', {}), {})
with ft.clear_and_catch_warnings(modules=[my_mod]):
warnings.simplefilter('ignore')
warnings.warn('Some warning')
npt.assert_equal(my_mod.__warningregistry__, {})
# Without specified modules, don't clear warnings during context
with ft.clear_and_catch_warnings():
warnings.warn('Some warning')
> assert_warn_len_equal(my_mod, 1)
fury\tests\test_testing.py:63:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mod = <module 'fury.tests.test_testing' from 'D:\\GSoC\\fury\\fury\\tests\\test_testing.py'>
n_in_context = 1
def assert_warn_len_equal(mod, n_in_context):
mod_warns = mod.__warningregistry__
# Python 3 appears to clear any pre-existing warnings of the same type,
# when raising warnings inside a catch_warnings block. So, there is a
# warning generated by the tests within the context manager, but no
# previous warnings.
if 'version' in mod_warns:
> npt.assert_equal(len(mod_warns), 2) # including 'version'
E AssertionError:
E Items are not equal:
E ACTUAL: 1
E DESIRED: 2
fury\tests\test_testing.py:42: AssertionError