add typing for tests
This commit is contained in:
parent
15bf399a89
commit
14d19ce9dd
5 changed files with 19 additions and 17 deletions
|
|
@ -2,18 +2,19 @@ from typer.testing import CliRunner
|
|||
from corrlib.cli import app
|
||||
import os
|
||||
import sqlite3 as sql
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
||||
def test_version():
|
||||
def test_version() -> None:
|
||||
result = runner.invoke(app, ["--version"])
|
||||
assert result.exit_code == 0
|
||||
assert "corrlib" in result.output
|
||||
|
||||
|
||||
def test_init_folders(tmp_path):
|
||||
def test_init_folders(tmp_path: Path) -> None:
|
||||
dataset_path = tmp_path / "test_dataset"
|
||||
result = runner.invoke(app, ["init", "--dataset", str(dataset_path)])
|
||||
assert result.exit_code == 0
|
||||
|
|
@ -21,7 +22,7 @@ def test_init_folders(tmp_path):
|
|||
assert os.path.exists(str(dataset_path / "backlogger.db"))
|
||||
|
||||
|
||||
def test_init_db(tmp_path):
|
||||
def test_init_db(tmp_path: Path) -> None:
|
||||
dataset_path = tmp_path / "test_dataset"
|
||||
result = runner.invoke(app, ["init", "--dataset", str(dataset_path)])
|
||||
assert result.exit_code == 0
|
||||
|
|
@ -37,7 +38,7 @@ def test_init_db(tmp_path):
|
|||
table_names = [table[0] for table in tables]
|
||||
for expected_table in expected_tables:
|
||||
assert expected_table in table_names
|
||||
|
||||
|
||||
cursor.execute("SELECT * FROM projects;")
|
||||
projects = cursor.fetchall()
|
||||
assert len(projects) == 0
|
||||
|
|
@ -60,7 +61,7 @@ def test_init_db(tmp_path):
|
|||
project_column_names = [col[1] for col in project_columns]
|
||||
for expected_col in expected_project_columns:
|
||||
assert expected_col in project_column_names
|
||||
|
||||
|
||||
cursor.execute("PRAGMA table_info('backlogs');")
|
||||
backlog_columns = cursor.fetchall()
|
||||
expected_backlog_columns = [
|
||||
|
|
@ -81,7 +82,7 @@ def test_init_db(tmp_path):
|
|||
assert expected_col in backlog_column_names
|
||||
|
||||
|
||||
def test_list(tmp_path):
|
||||
def test_list(tmp_path: Path) -> None:
|
||||
dataset_path = tmp_path / "test_dataset"
|
||||
result = runner.invoke(app, ["init", "--dataset", str(dataset_path)])
|
||||
assert result.exit_code == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue