debrief / pepys-import

Support library for Pepys maritime data analysis environment
https://pepys-import.readthedocs.io/
Apache License 2.0
5 stars 5 forks source link

Add (and integrate previous) tests for Pepys Timeline #890

Open robintw opened 3 years ago

robintw commented 3 years ago

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:

robintw commented 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:

You 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.

rnllv commented 3 years ago

Thanks for the heads up @robintw. I'll go through them and continue with the sql test cases.

rnllv commented 3 years ago

@robintw, @IanMayo,

I've enhanced the business logic description here. Should this be split between the python test file and the actual SQL file?