Changes to test_add_file to see why it's so slow

* profiling indicates that it's all the debug prints!
This commit is contained in:
Rob McMullen 2017-05-07 09:58:29 -07:00
parent 1e38dfb516
commit f41f86c1b0

View File

@ -8,12 +8,11 @@ from atrcopy.errors import *
class BaseFilesystemModifyTest(object): class BaseFilesystemModifyTest(object):
diskimage_type = None diskimage_type = None
sample_file = None sample_data = None
num_files_in_sample = 0 num_files_in_sample = 0
def setup(self): def setup(self):
data = np.fromfile(self.sample_file, dtype=np.uint8) rawdata = SegmentData(self.sample_data.copy())
rawdata = SegmentData(data)
self.image = self.diskimage_type(rawdata) self.image = self.diskimage_type(rawdata)
def check_entries(self, entries, prefix="TEST", save=None): def check_entries(self, entries, prefix="TEST", save=None):
@ -140,26 +139,29 @@ class BaseFilesystemModifyTest(object):
class TestAtariDosSDImage(BaseFilesystemModifyTest): class TestAtariDosSDImage(BaseFilesystemModifyTest):
diskimage_type = AtariDosDiskImage diskimage_type = AtariDosDiskImage
sample_file = "../test_data/dos_sd_test1.atr" sample_data = np.fromfile("../test_data/dos_sd_test1.atr", dtype=np.uint8)
num_files_in_sample = 5 num_files_in_sample = 5
class TestAtariDosEDImage(BaseFilesystemModifyTest): class TestAtariDosEDImage(BaseFilesystemModifyTest):
diskimage_type = AtariDosDiskImage diskimage_type = AtariDosDiskImage
sample_file = "../test_data/dos_ed_test1.atr" sample_data = np.fromfile("../test_data/dos_ed_test1.atr", dtype=np.uint8)
num_files_in_sample = 5 num_files_in_sample = 5
class TestAtariDosDDImage(BaseFilesystemModifyTest): class TestAtariDosDDImage(BaseFilesystemModifyTest):
diskimage_type = AtariDosDiskImage diskimage_type = AtariDosDiskImage
sample_file = "../test_data/dos_dd_test1.atr" sample_data = np.fromfile("../test_data/dos_dd_test1.atr", dtype=np.uint8)
num_files_in_sample = 5 num_files_in_sample = 5
class TestDos33Image(BaseFilesystemModifyTest): class TestDos33Image(BaseFilesystemModifyTest):
diskimage_type = Dos33DiskImage diskimage_type = Dos33DiskImage
sample_file = "../test_data/dos33_master.dsk" sample_data = np.fromfile("../test_data/dos33_master.dsk", dtype=np.uint8)
num_files_in_sample = 19 num_files_in_sample = 19
if __name__ == "__main__": if __name__ == "__main__":
t = TestAtariDosFile() t = TestAtariDosSDImage()
t.setup() for name in dir(t):
t.test_segment() print name
if name.startswith("test_"):
t.setup()
getattr(t, name)()