beanmachine icon indicating copy to clipboard operation
beanmachine copied to clipboard

[WIP] Pytest: Split & parametrise model/inference (intra-module)

Open ntfrgl opened this issue 3 years ago • 0 comments

Motivation

As a first step of the Pytest suite refactoring and extension, the model/observation/inference choices in the existing tests are explicitly parametrised as fixtures, and local (intra-module) redundancies are factored out. In a subsequent PR, the module hierarchy of the test suite will be reorganised.

Since the implied change set is of considerable size, at the time of opening this PR the refactoring is only carried out on a representative subset of the test suite, and will be extended over the rest upon initial feedback.

Changes proposed

  • standardize test discovery (unittest -> pytest)
  • extend model library in src/beanmachine/ppl/examples
  • create fixture helpers in tests/ppl/utils/fixtures.py
  • refactor similar tests locally

Test Plan

pytest

Types of changes

  • [x] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.
  • [x] The title of my pull request is a short description of the requested changes.

ntfrgl avatar Nov 03 '22 18:11 ntfrgl