Windows: enable more stage tests (#36834)

Enable some already-supported tests (no changes to staging logic).
This commit is contained in:
markus-ferrell 2023-08-09 17:24:30 -04:00 committed by GitHub
parent f5888d8127
commit 01b7cc5106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -659,7 +659,9 @@ def test_source_path_available(self, mock_stage_archive):
assert source_path.endswith(spack.stage._source_path_subdir)
assert not os.path.exists(source_path)
@pytest.mark.skipif(sys.platform == "win32", reason="Not supported on Windows (yet)")
@pytest.mark.skipif(
sys.platform == "win32", reason="Windows file permission erroring is not yet supported"
)
@pytest.mark.skipif(getuid() == 0, reason="user is root")
def test_first_accessible_path(self, tmpdir):
"""Test _first_accessible_path names."""
@ -691,7 +693,6 @@ def test_first_accessible_path(self, tmpdir):
# Cleanup
shutil.rmtree(str(name))
@pytest.mark.skipif(sys.platform == "win32", reason="Not supported on Windows (yet)")
def test_create_stage_root(self, tmpdir, no_path_access):
"""Test create_stage_root permissions."""
test_dir = tmpdir.join("path")
@ -755,7 +756,9 @@ def test_resolve_paths(self):
assert spack.stage._resolve_paths(paths) == res_paths
@pytest.mark.skipif(sys.platform == "win32", reason="Not supported on Windows (yet)")
@pytest.mark.skipif(
sys.platform == "win32", reason="Windows file permission erroring is not yet supported"
)
@pytest.mark.skipif(getuid() == 0, reason="user is root")
def test_get_stage_root_bad_path(self, clear_stage_root):
"""Ensure an invalid stage path root raises a StageError."""
@ -864,7 +867,6 @@ def test_diystage_preserve_file(self, tmpdir):
_file.read() == _readme_contents
@pytest.mark.skipif(sys.platform == "win32", reason="Not supported on Windows (yet)")
def test_stage_create_replace_path(tmp_build_stage_dir):
"""Ensure stage creation replaces a non-directory path."""
_, test_stage_path = tmp_build_stage_dir
@ -872,16 +874,15 @@ def test_stage_create_replace_path(tmp_build_stage_dir):
nondir = os.path.join(test_stage_path, "afile")
touch(nondir)
path = str(nondir)
path = url_util.path_to_file_url(str(nondir))
stage = Stage(path, name="")
stage = Stage(path, name="afile")
stage.create()
# Ensure the stage path is "converted" to a directory
assert os.path.isdir(stage.path)
assert os.path.isdir(nondir)
@pytest.mark.skipif(sys.platform == "win32", reason="Not supported on Windows (yet)")
def test_cannot_access(capsys):
"""Ensure can_access dies with the expected error."""
with pytest.raises(SystemExit):