Skip to content

When accessing raw['workspace'] internally via from_raw, a KeyError is raised. #16158

Description

@dabao1990

Describe the bug
This error occurs because you cannot directly issue commands in this way, right?

To Reproduce

python3 run_unittests.py -v -k "test_update_dependency"
Meson build system 1.12.0 Unit Tests
pytest not found, using unittest instead
test_update_dependency (unittests.cargotests.CargoTomlTest) ... ERROR

======================================================================
ERROR: test_update_dependency (unittests.cargotests.CargoTomlTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/stage/root/spack-stage-meson-1.12.0-fbeaizz5732ri2m5wh4zccudkd3dvgu3/spack-src/unittests/cargotests.py", line 438, in test_update_dependency
    workspace = Workspace.from_raw(workspace_toml, tmpdir)
  File "/home/stage/root/spack-stage-meson-1.12.0-fbeaizz5732ri2m5wh4zccudkd3dvgu3/spack-src/mesonbuild/cargo/manifest.py", line 661, in from_raw
    ws = _raw_to_dataclass(raw['workspace'], cls, 'Workspace')
KeyError: 'workspace'

----------------------------------------------------------------------
Ran 1 test in 0.046s

FAILED (errors=1)
Total time: 0.257 seconds

Expected behavior
pass

system parameters
cat /etc/os-release
NAME="openEuler"
VERSION="24.03 (LTS-SP2)"
ID="openEuler"
VERSION_ID="24.03"
PRETTY_NAME="openEuler 24.03 (LTS-SP2)"
ANSI_COLOR="0;31"

[root@localhost spack-src]#gcc --version
gcc (GCC) 12.3.1 (openEuler 12.3.1-95.oe2403sp2)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost spack-src]#python --version
Python 3.10.12
[root@localhost spack-src]#

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions