Closed bikegeek closed 2 hours ago
The additional tests contribute towards this issue: https://github.com/dtcenter/METplus-Internal/issues/50
Thanks for creating this ticket for me @bikegeek
I've spent some more time reading through the METdbLoad code and propose the following approach for testing.
Initially I'd like to write true "unit tests". These are tests that don't require a database and just check function behaviour. Since run_sql.py
provides a convenient abstraction layer for all database reads/writes, we can create a mock of RunSql
and use this to test all other modules.
Pros:
Cons:
run_sql.py
If we decide we want something more robust, we can have the tests operate on a real test database. This would be akin to "integration tests". To do this we'd need MySQL to be running in the test environment, and then write some test fixtures to manage the database state for each test.
Pros:
Cons:
The above approaches are not mutually exclusive. We can start with the no database approach and transition to using a database later on. It's likely we could come up with an implementation that can do either approach depending if MySQL is available. For example, the test infrastructure could use a real database when available, otherwise fall back to the mock RunSql
.
Let me know if you're happy with this approach, or have any questions?
To be assigned to John Sharples once he has accepted the invitation to join this repository.
Describe the Task
METdataio, specifically the METdbLoad modules require additional tests to increase the code coverage from its current status. Add appropriate tests, with particular focus on database loading.
Time Estimate
Estimate the amount of work required here. Issues should represent approximately 1 to 3 days of work.
Sub-Issues
Consider breaking the task down into sub-issues.
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
Define the source of funding and account keys here or state NONE.
Define the Metadata
Assignee
Labels
Milestone and Projects
Define Related Issue(s)
Consider the impact to the other METplus components.
Task Checklist
See the METplus Workflow for details.
feature_<Issue Number>_<Description>
feature <Issue Number> <Description>