Skip to content

Consider full switch to Pytest #1160

@Lotram

Description

@Lotram

Disclaimer: I'm biased towards pytest, it's used in most python projects, and I think it has been the standard in python for quite some time.

That said, I truly think the codebase would benefit from migrating to pytest

  • we already use pytest to run the tests anway, so it wouldn't add a dependency.
  • Simpler assertions: No more self.assertEqual(...), a simple assert a = b is ok.
  • we already have a few pytest fixtures, it's more powerful and (IMO) readable than setUp / teardown methods. I admit that this is the most biased argument I have, some people may disagree on fixtures being better than factories / setup functions.
  • pytest does not require to use classes, simple functions are fine, which is enough for simple tests (we can still use classes for bigger ones)
  • parametrize avoids a lot of redundancy
  • a lot of plugins are available, if we ever need any (let's say to run tests in parallel, or to randomize test order for example)

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenancedoesn't necessarily have an immediate impact on users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions