From 01b7cc51060a126ffbb8bec302736a6d46004fd9 Mon Sep 17 00:00:00 2001 From: markus-ferrell <116021216+markus-ferrell@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:24:30 -0400 Subject: Windows: enable more stage tests (#36834) Enable some already-supported tests (no changes to staging logic). --- lib/spack/spack/test/stage.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py index e507ac74e3..5e9e8ec855 100644 --- a/lib/spack/spack/test/stage.py +++ b/lib/spack/spack/test/stage.py @@ -659,7 +659,9 @@ class TestStage: 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 @@ class TestStage: # 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 @@ class TestStage: 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 @@ class TestStage: _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): -- cgit v1.2.3-60-g2f50