This is a proof-of-concept for unit tests with SQLAlchemy, which is used to serve as an example to discuss with approach to use for unit tests that involve the database:
. The question is whether to use this approach for unit tests that involve the database (create minimal in-memory databases), or use Raisinbread instead.
Approach 1: Use Raisinbread
Pros:
Less verbose, no need to populate the database outside of Raisinbread.
More representative data used in tests.
Cons:
Heavier, the unit tests need MariaDB and an unmodified Rainsinbread copy installed to be ran locally.
Needs to update tests if Raisinbread changes.
Clutter, the database has data irrelevant to each tests.
Approach 2: Use in-memory minimal databases (this PR)
Pros:
Lighter, the unit tests can be ran locally without MariaDB or Raisinbread installed.
Minimal, only the data relevant to each test is present in the database.
Customizable, can use different data for each test.
Cons:
More code, the unit tests need to create a minimal database for each test suite. Some factorization may be possible but ultimately all non-null and foreign key records must be populated for a test to run. It also means more test data to maintain.
This is a proof-of-concept for unit tests with SQLAlchemy, which is used to serve as an example to discuss with approach to use for unit tests that involve the database: . The question is whether to use this approach for unit tests that involve the database (create minimal in-memory databases), or use Raisinbread instead.
Approach 1: Use Raisinbread
Pros:
Cons:
Approach 2: Use in-memory minimal databases (this PR)
Pros:
Cons: