seamm_datastore.tests package

Submodules

seamm_datastore.tests.conftest module

Fixtures for testing

seamm_datastore.tests.conftest.admin_connection(connection)[source]
seamm_datastore.tests.conftest.connection()[source]
seamm_datastore.tests.conftest.filled_db(connection)[source]
seamm_datastore.tests.conftest.session()[source]

seamm_datastore.tests.test_build module

Tests for building/importing datastore

seamm_datastore.tests.test_build.test_build(connection)[source]
seamm_datastore.tests.test_build.test_import_datastore_duplicate_project_name_recovers(connection, tmp_path)[source]

A job_data.json listing the same project twice (a real case seen in production – e.g. from a job submitted with a malformed project list) used to crash the whole import scan with an IntegrityError (“UNIQUE constraint failed: job_project.job, job_project.project”), raised from session.commit() in import_datastore. That commit sat in an else: clause the surrounding try/except couldn’t reach, so the failure propagated out of import_datastore entirely – aborting the scan and leaving every job after the bad one (in directory-listing order) unimported too, every time the dashboard started.

Fixed two ways: Job.create() now dedupes project_names before it’s used to populate any relationship (the actual root cause – assigning the same related row twice to a SQLAlchemy many-to-many collection is what raises the IntegrityError), and import_datastore’s per-job add()/commit() is now inside the try/except with a rollback, so even an unrelated per-job failure can no longer take down the whole scan.

seamm_datastore.tests.test_errors module

seamm_datastore.tests.test_projects module

seamm_datastore.tests.test_seamm_datastore module

Unit and regression test for the seamm_datastore package.

seamm_datastore.tests.test_seamm_datastore.test_connected(admin_connection)[source]
seamm_datastore.tests.test_seamm_datastore.test_connection_logout(connection)[source]

seamm_datastore.tests.test_util module

Module contents

Empty init file in case you choose a package besides PyTest such as Nose which may look for such a file