Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ntfrgl
Copy link
Contributor

@ntfrgl ntfrgl commented Nov 3, 2022

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

  • 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

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

- port: unittest -> pytest
- factor out as fixtures: models, samplers, proposers
- standardise RV names in models with similar structures
- reduce intra-module code redundancy
- apply linting
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants