Fix spack test when SPACK_ROOT isn't set (#13980)
This commit is contained in:
parent
e0e9fb4462
commit
ba7ac53b75
@ -6,6 +6,7 @@
|
|||||||
"""Test Spack's URL handling utility functions."""
|
"""Test Spack's URL handling utility functions."""
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import spack.paths
|
||||||
import spack.util.url as url_util
|
import spack.util.url as url_util
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ def test_url_parse():
|
|||||||
assert(parsed.netloc == 'path')
|
assert(parsed.netloc == 'path')
|
||||||
assert(parsed.path == '/to/resource')
|
assert(parsed.path == '/to/resource')
|
||||||
|
|
||||||
spack_root = os.path.abspath(os.environ['SPACK_ROOT'])
|
spack_root = spack.paths.spack_root
|
||||||
parsed = url_util.parse('$spack')
|
parsed = url_util.parse('$spack')
|
||||||
assert(parsed.scheme == 'file')
|
assert(parsed.scheme == 'file')
|
||||||
assert(parsed.netloc == '')
|
assert(parsed.netloc == '')
|
||||||
@ -56,7 +57,7 @@ def test_url_parse():
|
|||||||
|
|
||||||
|
|
||||||
def test_url_local_file_path():
|
def test_url_local_file_path():
|
||||||
spack_root = os.path.abspath(os.environ['SPACK_ROOT'])
|
spack_root = spack.paths.spack_root
|
||||||
|
|
||||||
lfp = url_util.local_file_path('/a/b/c.txt')
|
lfp = url_util.local_file_path('/a/b/c.txt')
|
||||||
assert(lfp == '/a/b/c.txt')
|
assert(lfp == '/a/b/c.txt')
|
||||||
@ -171,7 +172,7 @@ def test_url_join_local_paths():
|
|||||||
'https://mirror.spack.io/build_cache/my-package')
|
'https://mirror.spack.io/build_cache/my-package')
|
||||||
|
|
||||||
# file:// URL path components are *NOT* canonicalized
|
# file:// URL path components are *NOT* canonicalized
|
||||||
spack_root = os.path.abspath(os.environ['SPACK_ROOT'])
|
spack_root = spack.paths.spack_root
|
||||||
|
|
||||||
join_result = url_util.join('/a/b/c', '$spack')
|
join_result = url_util.join('/a/b/c', '$spack')
|
||||||
assert(join_result == 'file:///a/b/c/$spack') # not canonicalized
|
assert(join_result == 'file:///a/b/c/$spack') # not canonicalized
|
||||||
|
Loading…
Reference in New Issue
Block a user