Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Sep 21, 2016
1 parent a57db52 commit 42c69c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions py/desiutil/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,7 @@ def set_install_dir(self):
self.nersc = None
if self.options.root is None or not isdir(self.options.root):
if self.nersc is not None:
self.options.root = join(self.default_nersc_dir[self.nersc],
'code')
self.options.root = self.default_nersc_dir[self.nersc]
else:
message = "DESI_PRODUCT_ROOT is missing or not set."
log.critical(message)
Expand Down
11 changes: 6 additions & 5 deletions py/desiutil/test/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,27 +299,28 @@ def test_set_install_dir(self):
'desiutil', 'master'])
self.desiInstall.get_product_version()
install_dir = self.desiInstall.set_install_dir()
self.assertEqual(install_dir, join(self.data_dir, 'desiutil',
self.assertEqual(install_dir, join(self.data_dir, 'code', 'desiutil',
'master'))
# Test for presence of existing directory.
tmpdir = join(self.data_dir, 'desiutil')
tmpdir = join(self.data_dir, 'code')
mkdir(tmpdir)
mkdir(join(tmpdir, 'master'))
mkdir(join(tmpdir, 'desiutil'))
mkdir(join(tmpdir, 'desiutil', 'master'))
options = self.desiInstall.get_options(['--root', self.data_dir,
'desiutil', 'master'])
self.desiInstall.get_product_version()
with self.assertRaises(DesiInstallException) as cm:
install_dir = self.desiInstall.set_install_dir()
self.assertEqual(str(cm.exception),
"Install directory, {0}, already exists!".format(
join(tmpdir, 'master')))
join(tmpdir, 'desiutil', 'master')))
options = self.desiInstall.get_options(['--root', self.data_dir,
'--force', 'desiutil',
'master'])
self.assertTrue(self.desiInstall.options.force)
self.desiInstall.get_product_version()
install_dir = self.desiInstall.set_install_dir()
self.assertFalse(isdir(join(tmpdir, 'master')))
self.assertFalse(isdir(join(tmpdir, 'desiutil', 'master')))
if isdir(tmpdir):
rmtree(tmpdir)
# Test NERSC installs. Unset DESI_PRODUCT_ROOT for this to work.
Expand Down

0 comments on commit 42c69c0

Please sign in to comment.