Skip to content

Commit

Permalink
A regression test for issue Astroua#92.
Browse files Browse the repository at this point in the history
I'm essentially just stashing this for now until we figure out what to do
about that issue.
  • Loading branch information
jeffctaylor committed Oct 16, 2015
1 parent d11ab86 commit f6e1449
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions carta/scriptedClient/tests/test_cartavis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import time
import pytest
import cartavis
from flaky import flaky
Expand Down Expand Up @@ -684,6 +685,22 @@ def test_loadFile_AstrometryTest(cartavisInstance, cleanSlate):
_loadFilesFromDirectory(i[0],
os.path.expanduser( '~/CARTA/Images/CARTAImages/AstrometryTest'))

def test_loadMultipleFilesRapidly(cartavisInstance, cleanSlate):
"""
Tests that multiple images can be loaded rapidly without problems.
This is a regression test to ensure that issue #92 has been dealt
with properly.
"""
i = cartavisInstance.getImageViews()
a = cartavisInstance.getAnimatorViews()
#directory = os.getcwd() + '/data/'
directory = '/home/jeff/CARTA/Images/'
for filename in os.listdir(directory):
if (os.path.isfile(directory + filename)
and filename.lower().endswith('.fits')):
i[0].loadFile(directory + filename)
test_setImageLayout(cartavisInstance, cleanSlate)

def _setImage(imageView, animatorView, tempImageDir):
"""
A common private function for commands that need to test that an
Expand All @@ -710,7 +727,10 @@ def _saveFullImage(imageView, imageName, tempImageDir):

def _loadFilesFromDirectory(imageView, directory):
"""
Attempts to lead each of the files in a directory.
Attempts to load each of the files in a directory.
The sleep statement is here for now to avoid the bug that occurs
when trying to load too many images too rapidly (issue #92).
"""
for fileName in os.listdir(directory):
assert imageView.loadFile(directory + '/' + fileName) == ['']
for filename in os.listdir(directory):
assert imageView.loadFile(directory + '/' + filename) == ['']
time.sleep(1)

0 comments on commit f6e1449

Please sign in to comment.