mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-13 03:10:03 -05:00
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:
@@ -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',
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user