def test_datacube_root_from_env(self): """Test finding the datacube root from the environment.""" test_dir = '/home/somewhere/ga-datacube' os.environ['DATACUBE_ROOT'] = test_dir datacube_root = cube_util.get_datacube_root() self.assertEqual(test_dir, datacube_root)
def test_datacube_root_from_inspect(self): """Test finding the datacube root using the inspect module.""" if 'DATACUBE_ROOT' in os.environ: del os.environ['DATACUBE_ROOT'] datacube_root = cube_util.get_datacube_root() # Verify that the directory returned at least contains datacube # code. Probably about the best we can do without calling inspect # ourselves. module_path = os.path.join(datacube_root, 'test_cube_util.py') if not os.path.isfile(module_path): self.fail("Cannot find module file at datacube_root:\n" + " " + module_path + "\n")