Page MenuHomeSoftware Heritage

Update tests to pytest
ClosedPublic

Authored by douardda on Oct 16 2019, 11:01 AM.

Details

Summary

This is done in several steps:

  • conftest: simplify the swh_scheduler() fixture. Simply use the postgresql.dsn as connection string.
  • updater/tests: rewrite updater's tests as pytest functions. The way the scheduler_db and updater_db fixtures are built is not very straighforward nor satisfying, but it works.
  • add a new get_priority_ratios endpoint to the scheduler This is necessary to make it much easier to write tests so they do not need to execute SQL statements, which makes possible to run exactly the same tests with the SchedulerBackend as the RemoteScheduler one (see the following revision).
  • rewrite scheduler tests using pytest and the new rpc fixtures from swh.core.

Diff Detail

Repository
rDSCH Scheduling utilities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added a subscriber: ardumont.

Thanks!

swh/scheduler/tests/updater/test_writer.py
34 ↗(On Diff #7262)

:)

maybe we could stop using those in our sql definitions...

This revision is now accepted and ready to land.Oct 16 2019, 1:15 PM

Build has FAILED

mypy is unhappy, don't know why though.

  flake8: commands succeeded
ERROR:   mypy: commands failed

Build has FAILED

mypy is unhappy, don't know why though.

  flake8: commands succeeded
ERROR:   mypy: commands failed

Because I forgot to amend the mypy.ini file...

Add forgotten mypy.ini and requirements-test.txt files