Windows: enable more stage tests (#36834)
Enable some already-supported tests (no changes to staging logic).
This commit is contained in:
		@@ -659,7 +659,9 @@ def test_source_path_available(self, mock_stage_archive):
 | 
				
			|||||||
        assert source_path.endswith(spack.stage._source_path_subdir)
 | 
					        assert source_path.endswith(spack.stage._source_path_subdir)
 | 
				
			||||||
        assert not os.path.exists(source_path)
 | 
					        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")
 | 
					    @pytest.mark.skipif(getuid() == 0, reason="user is root")
 | 
				
			||||||
    def test_first_accessible_path(self, tmpdir):
 | 
					    def test_first_accessible_path(self, tmpdir):
 | 
				
			||||||
        """Test _first_accessible_path names."""
 | 
					        """Test _first_accessible_path names."""
 | 
				
			||||||
@@ -691,7 +693,6 @@ def test_first_accessible_path(self, tmpdir):
 | 
				
			|||||||
        # Cleanup
 | 
					        # Cleanup
 | 
				
			||||||
        shutil.rmtree(str(name))
 | 
					        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):
 | 
					    def test_create_stage_root(self, tmpdir, no_path_access):
 | 
				
			||||||
        """Test create_stage_root permissions."""
 | 
					        """Test create_stage_root permissions."""
 | 
				
			||||||
        test_dir = tmpdir.join("path")
 | 
					        test_dir = tmpdir.join("path")
 | 
				
			||||||
@@ -755,7 +756,9 @@ def test_resolve_paths(self):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        assert spack.stage._resolve_paths(paths) == res_paths
 | 
					        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")
 | 
					    @pytest.mark.skipif(getuid() == 0, reason="user is root")
 | 
				
			||||||
    def test_get_stage_root_bad_path(self, clear_stage_root):
 | 
					    def test_get_stage_root_bad_path(self, clear_stage_root):
 | 
				
			||||||
        """Ensure an invalid stage path root raises a StageError."""
 | 
					        """Ensure an invalid stage path root raises a StageError."""
 | 
				
			||||||
@@ -864,7 +867,6 @@ def test_diystage_preserve_file(self, tmpdir):
 | 
				
			|||||||
            _file.read() == _readme_contents
 | 
					            _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):
 | 
					def test_stage_create_replace_path(tmp_build_stage_dir):
 | 
				
			||||||
    """Ensure stage creation replaces a non-directory path."""
 | 
					    """Ensure stage creation replaces a non-directory path."""
 | 
				
			||||||
    _, test_stage_path = tmp_build_stage_dir
 | 
					    _, 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")
 | 
					    nondir = os.path.join(test_stage_path, "afile")
 | 
				
			||||||
    touch(nondir)
 | 
					    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()
 | 
					    stage.create()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Ensure the stage path is "converted" to a directory
 | 
					    # 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):
 | 
					def test_cannot_access(capsys):
 | 
				
			||||||
    """Ensure can_access dies with the expected error."""
 | 
					    """Ensure can_access dies with the expected error."""
 | 
				
			||||||
    with pytest.raises(SystemExit):
 | 
					    with pytest.raises(SystemExit):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user