def setUp(self): self.folder = get_tests_dir() self.file_old1 = os.path.join(self.folder, 'temp image A.jpg') self.file_old2 = os.path.join(self.folder, 'temp xtra image B.jpg') self.file_new1 = os.path.join(self.folder, 'Photo 01.jpg') self.file_new2 = os.path.join(self.folder, 'Photo 02.jpg') self.prefix = 'Photo ' self.start = 1 self.digits = 2 write_text_file(self.file_old1, '') write_text_file(self.file_old2, '')
def setUpClass(cls): cls.folder = get_tests_dir() cls.folder_exclusions = [os.path.join(cls.folder, 'temp_dir'), \ os.path.join(cls.folder, 'coverage_html_report')] file1 = os.path.join(cls.folder, 'temp image 01.jpg') file2 = os.path.join(cls.folder, 'temp image 02.jpg') file3 = os.path.join(cls.folder, 'temp image 04.jpg') file4 = os.path.join(cls.folder, 'temp image 006.jpg') file5 = os.path.join(cls.folder, 'temp something else 1.jpg') file6 = os.path.join(cls.folder, 'Picasa.ini') file7 = os.path.join(cls.folder, 'temp image 10 10.jpg') if not os.path.isdir(cls.folder_exclusions[0]): os.mkdir(cls.folder_exclusions[0]) file8 = os.path.join(cls.folder_exclusions[0], 'temp image 01.jpg') file9 = os.path.join(cls.folder_exclusions[0], 'temp longimagename.jpg') cls.files = [ file1, file2, file3, file4, file5, file6, file7, file8, file9 ] for this_file in cls.files: write_text_file(this_file, '')
def setUpClass(cls): cls.source = os.path.join(get_images_dir(), 'python.png') cls.name1 = 'image1.jpg' cls.name2 = 'image2.jpg' cls.name3 = 'image3.jpg' cls.name4 = 'image4.jpg' cls.name5 = 'image5.jpg' cls.name6 = 'image6.jpeg' cls.folder = os.path.join(get_tests_dir(), 'images') cls.extra = os.path.join(cls.folder, 'extra') cls.size1 = 128 cls.size2 = 96 cls.size3 = 32 cls.size4 = 128 * 2 cls.size5 = 96 * 2 cls.size6 = 4 cls.output = os.path.join(cls.folder, 'resized') with capture_output(): setup_dir(cls.folder) setup_dir(cls.extra) with open(cls.source, 'rb') as file: img = Image.open(file) img.load() img = img.convert( 'RGB' ) # remove transparency (alpha) channel to allow JPG saving new_img = img.resize((cls.size1, cls.size1), Image.ANTIALIAS) new_img.save(os.path.join(cls.folder, cls.name1)) new_img.save(os.path.join(cls.folder, cls.name6)) new_img = img.resize((cls.size2, cls.size1), Image.ANTIALIAS) new_img.save(os.path.join(cls.folder, cls.name2)) new_img = img.resize((cls.size1, cls.size2), Image.ANTIALIAS) new_img.save(os.path.join(cls.folder, cls.name3)) new_img = img.resize((cls.size1, cls.size6), Image.ANTIALIAS) new_img.save(os.path.join(cls.folder, cls.name4)) new_img = img.resize((cls.size6, cls.size1), Image.ANTIALIAS) new_img.save(os.path.join(cls.folder, cls.name5)) img.close() new_img.close()
def test_function(self): folder = dcs2.get_tests_dir() self.assertEqual(folder, os.path.join(dcs2.get_root_dir(), 'tests'))
def setUp(self): self.folder = get_tests_dir()
def setUp(self): self.folder = get_tests_dir() self.file_old = os.path.join(self.folder, 'temp image 01.JPG') self.file_new = os.path.join(self.folder, 'temp image 01.jpg') write_text_file(self.file_old, '')
def setUp(self): self.folder = get_tests_dir() self.file_old = os.path.join(self.folder, 'Picasa.ini') self.file_new = os.path.join(self.folder, '.picasa.ini') write_text_file(self.file_old, '')