Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctest python-unit-utils/oscal fails on Ubuntu 24.04 #12795

Open
mpurg opened this issue Jan 9, 2025 · 1 comment
Open

ctest python-unit-utils/oscal fails on Ubuntu 24.04 #12795

mpurg opened this issue Jan 9, 2025 · 1 comment

Comments

@mpurg
Copy link
Contributor

mpurg commented Jan 9, 2025

Description of problem:

ctest python-unit-utils/oscal fails on Ubuntu 24.04 since PR #12791

Failing github action: https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791

Error output:

ctest -j2 --output-on-failure -E unique-stigids
  shell: /usr/bin/bash -e {0}
Test project /home/runner/work/content/content/build
      Start  7: test-rule-dir-json
      Start  1: unique-cces
 1/49 Test  #1: unique-cces .......................................   Passed    0.29 sec
      Start  2: python-unit-utils
 2/49 Test  #2: python-unit-utils .................................   Passed    1.42 sec
      Start  [3](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:3): python-unit-ssg-module
 3/[4](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:5)9 Test  #3: python-unit-ssg-module ............................   Passed   10.38 sec
      Start  4: python-unit-ssg_test_suite
 4/49 Test  #7: test-rule-dir-json ................................   Passed   1[5](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:6).71 sec
      Start  5: python-unit-utils/oscal
 5/49 Test  #5: python-unit-utils/oscal ...........................***Failed    1.87 sec
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0
rootdir: /home/runner/work/content/content
plugins: anyio-4.8.0, cov-4.1.0
collected 0 items / 3 errors

==================================== ERRORS ====================================
_________ ERROR collecting tests/unit/utils/oscal/test_cd_generator.py _________
../../tests/unit/utils/oscal/test_cd_generator.py:10: in <module>
    from trestle.common.common_types import TopLevelOscalModel
/home/runner/.local/lib/python3.12/site-packages/trestle/common/common_types.py:19: in <module>
    import trestle.oscal.component as comp
/home/runner/.local/lib/python3.12/site-packages/trestle/oscal/component.py:3[6](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:7): in <module>
    import trestle.oscal.common as common
/home/runner/.local/lib/python3.12/site-packages/trestle/oscal/common.py:921: in <module>
    class AssessmentPart(OscalBaseModel):
pydantic/main.py:292: in pydantic.main.ModelMetaclass.__new__
    ???
pydantic/main.py:813: in pydantic.main.BaseModel.__try_update_forward_refs__
    ???
pydantic/typing.py:566: in pydantic.typing.update_model_forward_refs
    ???
pydantic/typing.py:532: in pydantic.typing.update_field_forward_refs
    ???
pydantic/typing.py:[7](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:8)5: in pydantic.typing.evaluate_forwardref
    ???
E   TypeError: ForwardRef._evaluate() got an unexpected keyword argument 'type_params'
_______ ERROR collecting tests/unit/utils/oscal/test_control_selector.py _______
../../tests/unit/utils/oscal/test_control_selector.py:5: in <module>
    from utils.oscal.control_selector import PolicyControlSelector
../../utils/oscal/__init__.py:[8](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:9): in <module>
    from trestle.oscal.common import Property
/home/runner/.local/lib/python3.12/site-packages/trestle/oscal/common.py:507: in <module>
    class OscalVersion(OscalBaseModel):
/home/runner/.local/lib/python3.12/site-packages/trestle/oscal/common.py:514: in OscalVersion
    @validator('__root__')
pydantic/class_validators.py:[9](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:10)3: in pydantic.class_validators.validator.dec
    ???
pydantic/class_validators.py:156: in pydantic.class_validators._prepare_validator
    ???
E   pydantic.errors.ConfigError: duplicate validator function "trestle.oscal.common.OscalVersion.oscal_version_is_valid"; if this is intended, set `allow_reuse=True`
______ ERROR collecting tests/unit/utils/oscal/test_rules_transformer.py _______
../../tests/unit/utils/oscal/test_rules_transformer.py:5: in <module>
    from trestle.oscal.common import Property
/home/runner/.local/lib/python3.[12](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:13)/site-packages/trestle/oscal/common.py:507: in <module>
    class OscalVersion(OscalBaseModel):
/home/runner/.local/lib/python3.12/site-packages/trestle/oscal/common.py:5[14](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:15): in OscalVersion
    @validator('__root__')
pydantic/class_validators.py:93: in pydantic.class_validators.validator.dec
    ???
pydantic/class_validators.py:[15](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:16)6: in pydantic.class_validators._prepare_validator
    ???
E   pydantic.errors.ConfigError: duplicate validator function "trestle.oscal.common.OscalVersion.oscal_version_is_valid"; if this is intended, set `allow_reuse=True`
=============================== warnings summary ===============================
../../ssg/requirement_specs.py:5
  /home/runner/work/content/content/ssg/requirement_specs.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

../../../../../../../usr/lib/python3/dist-packages/pkg_resources/__init__.py:2871
  /usr/lib/python3/dist-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('ruamel')`.
  Implementing implicit namespace packages (as specified in PEP 4[20](https://github.com/ComplianceAsCode/content/actions/runs/12672062360/job/35315236136?pr=12791#step:6:21)) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

../../../../../../../usr/lib/python3/dist-packages/pkg_resources/__init__.py:2871
  /usr/lib/python3/dist-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('zope')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.12.3-final-0 -----------
Coverage XML written to file coverage.xml

=========================== short test summary info ============================
ERROR ../../tests/unit/utils/oscal/test_cd_generator.py - TypeError: ForwardRef._evaluate() got an unexpected keyword argument 'type_params'
ERROR ../../tests/unit/utils/oscal/test_control_selector.py - pydantic.errors.ConfigError: duplicate validator function "trestle.oscal.common.OscalVersion.oscal_version_is_valid"; if this is intended, set `allow_reuse=True`
ERROR ../../tests/unit/utils/oscal/test_rules_transformer.py - pydantic.errors.ConfigError: duplicate validator function "trestle.oscal.common.OscalVersion.oscal_version_is_valid"; if this is intended, set `allow_reuse=True`
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!
======================== 3 warnings, 3 errors in 1.56s =========================

SCAP Security Guide Version:

master branch

Operating System Version:

Ubuntu 24.04

Steps to Reproduce:

  1. pip3 install -r compliance-trestle=2.4.0 # make sure trestle is installed
  2. ./build_product ubuntu2404
  3. cd build && ctest -j8 --output-on-failure -E unique-stigids

Actual Results:

Test python-unit-utils/oscal fails

Expected Results:

Test python-unit-utils/oscal passes

Additional Information/Debugging Steps:

@Mab879
Copy link
Member

Mab879 commented Jan 9, 2025

This issue with pydantic. Hopefully they will release a fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants