Open robintw opened 3 years ago
@arunlal-v I've created a PR to add your original test functions from pepys-timeline. See #891.
I've done some fairly minor changes to make the tests work with pytest (which we use for tests in Pepys Import), and to satisfy the automatic code formatter that we use (black) and the Python style testing tool we use (flake8).
To be able to contribute, I'd suggest:
pytest tests/timeline_tests/test_dashboard_sql_functions.py
pre-commit
hook set up, so that code formatting and checking is automatically done on each commitYou should then be able to create a new branch and PR, and work on the tests.
Thank you for developing the tests using many of the same libraries that we're using for Pepys Import testing - for example, testing.postgresql
. We have a mix of different coding styles in the Pepys Import tests, but we're trying to move away from unittest-style asserts - like self.assertTrue(validate(rows, ["G"], ["12:12:12"]))
or self.assertEqual(a, 42)
, and instead use pytest-style asserts like assert validate(rows, ["G"], ["12:12:12"])
and assert a == 42
- as they're cleaner to read, and actually give better error messages.
Let me know if you need any help with any of these steps.
@krsnik93 It'd be good if you could follow these instructions too, then we can work on the Flask/JS tests in this repo too.
Thanks for the heads up @robintw. I'll go through them and continue with the sql test cases.
Pepys Timeline is currently significantly under-tested. There are a few tests in the pepys-timeline repo that should be copied over and integrated, and then we should add tests for the Flask app (for example, using pytest-flask).
The areas that need covering by tests include: