Skip to content
  • Todd Gamblin's avatar
    tests: each mock package now has its own class (#16157) · c6ada206
    Todd Gamblin authored
    Packages in Spack are classes, and we need to be able to execute class
    methods on mock packages.  The previous design used instances of a single
    MockPackage class; this version gives each package its own class that can
    spider depenencies.  This allows us to implement class methods like
    `possible_dependencies()` on mock packages.
    
    This design change moves mock package creation into the
    `MockPackageMultiRepo`, and mock packages now *must* be created from a
    repo.  This is required for us to mock `possible_dependencies()`, which
    needs to be able to get dependency packages from the package repo.
    
    Changes include:
    
    * `MockPackage` is now `MockPackageBase`
    * `MockPackageBase` instances must now be created with
      `MockPackageMultiRepo.add_package()`
    * add `possible_dependencies()` method to `MockPackageBase`
    * refactor tests to use new code structure
    * move package mocking infrastructure into `spack.util.mock_package`,
      as it's becoming a more sophisticated class and it gets lots in `conftest.py`
    c6ada206