diff --git a/soitool/codebook.py b/soitool/codebook.py index 84c3ccfcbcfaa12d3e605b55aa7f82eed97c5132..5c783b0c698a73b74edd26e71096994eda14968c 100644 --- a/soitool/codebook.py +++ b/soitool/codebook.py @@ -22,6 +22,7 @@ class CodeBookTableView(QTableView): Parameter 'database' should be an instance of soitool.database.Database, and is used to create a QSqlDatabase from the database-file. + Raises RuntimeError if database does not open. """ diff --git a/soitool/codebook_to_pdf.py b/soitool/codebook_to_pdf.py index 0fe35b87c2f5c31400432166fc17402975f2e95d..991b105c9eb147f4f2f6b5d35871be02b73a1a9d 100644 --- a/soitool/codebook_to_pdf.py +++ b/soitool/codebook_to_pdf.py @@ -60,7 +60,7 @@ def generate_codebook_pdf( Parameters ---------- database : soitool.database.Database - Reference to database-instance + Reference to database-instance. small : bool, optional Data is from full codebook if False (default), from small codebook if True. @@ -139,7 +139,7 @@ def get_codebook_data(database, small=False): Parameters ---------- database : soitool.database.Database - Reference to database-instance + Reference to database-instance. small : bool Retrieves full codebook if False (default), small codebook if True. diff --git a/soitool/database.py b/soitool/database.py index 8814aef0d69db18be92b59f012b8e761ca073848..75d19fc2ff3be752f89af441c289daeca95315f1 100644 --- a/soitool/database.py +++ b/soitool/database.py @@ -6,7 +6,7 @@ from datetime import datetime import soitool.coder from soitool.enumerates import CodebookSort -# Set name and path to default (, future) database +# Set name and path to default (future) database DBNAME = "database" CURDIR = os.path.dirname(__file__) DBPATH = os.path.join(CURDIR, DBNAME) @@ -33,9 +33,9 @@ LASTUPDATED = "CREATE TABLE LastUpdated(Timestamp DATETIME PRIMARY KEY)" class Database: """Holds database-connection and related functions. - Connects to existing db if found, creates new db if not. + Uses default database unless parameter 'db_path', path to a database-file, + is given. Connects to existing db if found, creates new db if not. If db is created, tables are created and filled. - Uses default database unless parameter 'db_path' is given. Holds a QTimer that requests an update of CodeBook on every timeout. """ diff --git a/test/test_codebook_to_pdf.py b/test/test_codebook_to_pdf.py index fa553e016cba32106e2803c48c3455efc166fc98..0839d33b1bf88c7f34815ed0a72af47e521dfcf3 100644 --- a/test/test_codebook_to_pdf.py +++ b/test/test_codebook_to_pdf.py @@ -6,7 +6,10 @@ from pathlib import Path from datetime import datetime from soitool import codebook_to_pdf from soitool.database import Database -from test.test_database import TESTDBPATH + +TESTDBNAME = "testDatabase" +SOITOOL_DIR = Path(__file__).parent.parent / "soitool" +TESTDBPATH = os.path.join(SOITOOL_DIR, TESTDBNAME) SOITOOL_ROOT_PATH = Path(__file__).parent.parent