From f41f86c1b07d773bf1ae4916eb323bab35a8f00d Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Sun, 7 May 2017 09:58:29 -0700 Subject: [PATCH] Changes to test_add_file to see why it's so slow * profiling indicates that it's all the debug prints! --- test/test_add_file.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/test_add_file.py b/test/test_add_file.py index b4f14e3..1a2652e 100644 --- a/test/test_add_file.py +++ b/test/test_add_file.py @@ -8,12 +8,11 @@ from atrcopy.errors import * class BaseFilesystemModifyTest(object): diskimage_type = None - sample_file = None + sample_data = None num_files_in_sample = 0 def setup(self): - data = np.fromfile(self.sample_file, dtype=np.uint8) - rawdata = SegmentData(data) + rawdata = SegmentData(self.sample_data.copy()) self.image = self.diskimage_type(rawdata) def check_entries(self, entries, prefix="TEST", save=None): @@ -140,26 +139,29 @@ class BaseFilesystemModifyTest(object): class TestAtariDosSDImage(BaseFilesystemModifyTest): 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 class TestAtariDosEDImage(BaseFilesystemModifyTest): 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 class TestAtariDosDDImage(BaseFilesystemModifyTest): 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 class TestDos33Image(BaseFilesystemModifyTest): 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 if __name__ == "__main__": - t = TestAtariDosFile() - t.setup() - t.test_segment() + t = TestAtariDosSDImage() + for name in dir(t): + print name + if name.startswith("test_"): + t.setup() + getattr(t, name)()