Пример #1
0
 def test_create_database(self):
     dropdb()
     create_database()
     self.assertTrue(database_connectivity())
     self.assertTrue(database_exists())
     self.assertTrue(schema_is_sane())
     self.assertFalse(schema_has_data())
Пример #2
0
            try:
                filename = fq_to_sample_id.search(fq_url).group(0)
            except:
                continue
            sample_id = filename.rstrip('.fastq.gz').strip('seqs_')
            insert_fastq_sample(cur, sample_id, fq_url)


if __name__ == '__main__':
    import sys

    if not database_connectivity():
        sys.stderr.write("Cannot connect to the database\n")
        sys.exit(1)
    if not database_exists():
        sys.stderr.write('Database does not exist\n')
        sys.exit(1)
    if not schema_is_sane():
        sys.stderr.write('Schema does not appear to be sane\n')
        sys.exit(1)

    c = connect(user=agr.admin_db_user, host=agr.db_host,
                password=agr.admin_db_password, dbname=agr.db_name)
    c.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
    cur = c.cursor()

    if biom_unchanged(cur):
        # data are the same, no change
        sys.exit(0)
Пример #3
0
 def test_database_exists(self):
     dropdb()
     self.assertFalse(database_exists())
     createdb()
     self.assertTrue(database_exists())