def setUp(self): """Create a simple test project""" self.elements = ProjectObjectDict.example( ) # note: project_type = mesh # Note: We have to create a unique project pathname to pass stress testing # which runs jobs in parallel. self.temp_directory = tempfile.mkdtemp()
def test_object_io(self): """Write to files and then read back in.""" # check that writing meshes creates the directory and stores a glb file there orig_pod = ProjectObjectDict.example() path = self.temp_directory xml = orig_pod.save(path) # FIXME: Disabled check. Only works in Python 3. # ET interface must be different. # self.assertIsInstance(xml, ET.Element) self.assertTrue( os.path.isfile(os.path.join(self.temp_directory, "1.glb"))) # check that reading meshes gives the same as what we started with new_pod = ProjectObjectDict.load("meshes", xml, path) self.assertTrue(new_pod.almost_equal(orig_pod)) for obj in orig_pod.values(): self.assertTrue(obj.almost_equal(new_pod[obj.id]))
def setUp(self): """Create a few ProjectObjects for use in the ProjectObjectDict.""" self.pod = ProjectObjectDict.example() self.temp_directory = tempfile.mkdtemp()