Uploaded image for project: 'Cost Management'
  1. Cost Management
  2. COST-4692

Use pytest in koku

XMLWordPrintable

      We currently use tox to run tests locally and pipenv to run them in CI. We should unify the ways tests are run and move the tests to pytest run by tox.

      pytest has a number of advantages over unittest:

      • Tests are simpler to read and write. They are functions, not classes.
      • pytest uses fixtures instead of setup/teardown methods. Fixtures are more flexible and easier to reuse.
      • The built-in fixtures such as monkeypatch and tmp_path provide convenient ways to modify objects and create temporary files for testing
      • Marks, such as parametrize and xfail, are great for running the same test against different inputs or handling flaky tests
      • Custom marks are a convenient way to run groups of tests
      • Convenient ways to open a debugger on test failure or only run the last failed tests
      • There are many plugins that extend pytest, and we can easily write our own if needed

      We do not have to change any existing tests since pytest can run unittest-style tests.

            Unassigned Unassigned
            rh-ee-sdoran Sam Doran
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: