Fix import of noms.staging in stage.py (#2510)

Also fix unit test that was not updated when the functions were
renamed.
This commit is contained in:
Erik Arvidsson
2016-09-02 13:09:07 -07:00
committed by GitHub
parent 48854dc999
commit f465b0bd3c
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -4,9 +4,9 @@
# Licensed under the Apache License, version 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
sys.path.append(os.path.abspath('../../../tools'))
import noms.staging as staging
if __name__ == '__main__':
staging.Main('perf', staging.GlobCopier(
'index.html',
+1 -1
View File
@@ -4,8 +4,8 @@
# Licensed under the Apache License, version 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
sys.path.append(os.path.abspath('../../../tools'))
import noms.staging as staging
if __name__ == '__main__':
staging.Main('splore', staging.GlobCopier('out.js', 'index.html', 'styles.css'))
+6 -6
View File
@@ -16,32 +16,32 @@ class TestStaging(unittest.TestCase):
shutil.rmtree(self.tempdir, ignore_errors=True)
def test_Nested(self):
self.assertTrue(staging._isSubDir(self.nested, self.tempdir))
self.assertTrue(staging._is_sub_dir(self.nested, self.tempdir))
def test_NotNested(self):
otherNested = tempfile.mkdtemp(dir=self.tempdir)
self.assertFalse(staging._isSubDir(self.nested, otherNested))
self.assertFalse(staging._is_sub_dir(self.nested, otherNested))
def test_DotDotNotReallyNested(self):
notReallyNested = os.path.join(self.tempdir, 'foo', os.pardir, 'bar')
self.assertFalse(staging._isSubDir(self.nested, notReallyNested))
self.assertFalse(staging._is_sub_dir(self.nested, notReallyNested))
def test_LinkNotReallyNested(self):
otherNested = tempfile.mkdtemp(dir=self.tempdir)
linkName = os.path.join(self.nested, 'link')
os.symlink(otherNested, linkName)
self.assertFalse(staging._isSubDir(linkName, self.nested))
self.assertFalse(staging._is_sub_dir(linkName, self.nested))
def test_DirPath(self):
linkName = os.path.join(self.tempdir, 'link')
os.symlink(self.nested, linkName)
norm = staging._dirPath(linkName)
norm = staging._dir_path(linkName)
self.assertEqual(self.nested, norm)
def test_DirPathFails(self):
f = tempfile.NamedTemporaryFile(dir=self.tempdir)
try:
staging._dirPath(f.name)
staging._dir_path(f.name)
except ValueError:
pass