Skip to content

Fixture support #18

Description

@epage

The idea is to print pytest-like fixtures to Rust, like test-r and rustest do.

Fixtures should allow composable test setup and tear down

  • Fixtures can take fixtures
  • Fixtures can be paramaterized (Parametrized tests support #19)
  • Fixtures can be ignored, causing dependent tests to be Skipped (#[ignore] macro support #16)
  • Fixtures can panic, causing dependent tests to be Skipped (#[should_panic] macro support #15)
  • Teardown is down through the type returned
    • Like rustest, we offer a teardown attribute. Should probably be named drop
    • Once we have generators in Rust, we could consider using those for setup/teardown phases
  • Fixtures can be scoped to the parameter, test, or global

Differences from Pytest

  • Like rustest, fixtures should be found by their type through the type system, rather than behind the scenes machinery like pytest.
  • While fixtures can be parameterized (Parametrized tests support #19), fixtures can't enumerate parameters. Pytest allows parameterization through both markers and fixtures while we'll keep these separate. If nothing else, this will give a clear demarcation point for what runs during Discovery Phase (parameter discovery) vs Run Phase (fixtures)

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

    A-pytestArea: pytest-like framework implemented on top of the new harnessC-enhancementCategory: Raise on the bar on expectations

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions