MCPcopy Create free account
hub / github.com/PyTables/PyTables / setUp

Method setUp

tables/tests/test_tree.py:691–728  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

689 """Checks for deep hierarchy levels in PyTables trees."""
690
691 def setUp(self):
692 super().setUp()
693
694 # Here we put a more conservative limit to deal with more platforms
695 # With maxdepth = 64 this test would take less than 40 MB
696 # of main memory to run, which is quite reasonable nowadays.
697 # With maxdepth = 1024 this test will take around 300 MB.
698 if common.heavy:
699 self.maxdepth = 256 # Takes around 60 MB of memory!
700 else:
701 self.maxdepth = 64 # This should be safe for most machines
702 if common.verbose:
703 print("Maximum depth tested :", self.maxdepth)
704
705 # Open a new empty HDF5 file
706 group = self.h5file.root
707 if common.verbose:
708 print("Depth writing progress: ", end=" ")
709
710 # Iterate until maxdepth
711 for depth in range(self.maxdepth):
712 # Save it on the HDF5 file
713 if common.verbose:
714 print("%3d," % (depth), end=" ")
715 # Create a couple of arrays here
716 self.h5file.create_array(
717 group, "array", [1, 1], "depth: %d" % depth
718 )
719 self.h5file.create_array(
720 group, "array2", [1, 1], "depth: %d" % depth
721 )
722 # And also a group
723 self.h5file.create_group(group, "group2_" + str(depth))
724 # Finally, iterate over a new group
725 group = self.h5file.create_group(group, "group" + str(depth))
726
727 # Close the file
728 self.h5file.close()
729
730 def _check_tree(self, filename):
731 # Open the previous HDF5 file in read-only mode

Callers

nothing calls this directly

Calls 4

create_groupMethod · 0.80
setUpMethod · 0.45
create_arrayMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected