Skip to content

[UNEXPECTED BEHAVIOR] ADC _high_cost tests fail when run standalone #3648

Done

Description

@jeanwsr

Describe the unexpected behavior
Several _high_cost tests in pyscf/adc/test/test_uadc/ don't set myadc.method_type themselves. They pass in full-file runs only because unittest executes methods alphabetically and a low-cost sibling (test_ee_adc2) happens to run first and set myadc.method_type = "ee" on the shared module-level ADC object. When the low-cost tests are filtered out (-k), the high-cost EE tests run with the "ip" default and produce garbage.

Repro:

# Whole file: passes (test_ee_adc2 sets method_type="ee" first)
python -m pytest pyscf/adc/test/test_uadc/test_ee_F2.py
# -> 4 passed

# Only the high-cost test: the low-cost setter is deselected
python -m pytest pyscf/adc/test/test_uadc/test_ee_F2.py -k "high_cost"
# -> 1 failed
# E  AssertionError: 0.5085705788015883 != 0.3884663487 within 6 places

Affected tests:

  • test_ee_{CN,F2,O2}.py::test_ee_adc3_high_cost
  • test_ee_df_{CN,F2,H2O,O2}.py::test_ee_adc3_high_cost
  • test_ee_df_rohf_{O2,OH}.py::test_ee_adc3_high_cost
  • test_ee_outcore_O2.py::test_ee_adc2x_high_cost and ::test_ee_adc3_high_cost
  • test_ee_outcore_{OH,rohf_OH}.py::test_ee_adc3_high_cost
  • test_ee_rohf_{CN,O2,OH}.py::test_ee_adc3_high_cost

Suggested fix: make each high-cost test self-contained by setting myadc.method_type = "ee" explicitly.

Version and hardware (please complete the following information):

  • PySCF version latest
  • PySCF install type: built from source
  • Operating system: Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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