Skip to content

Commit 06ef89e

Browse files
committed
💬 add copyright header
1 parent 50ab8dd commit 06ef89e

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

sqlite3_to_mysql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Utility to transfer data from SQLite 3 to MySQL."""
2-
__version__ = "2.1.6"
2+
__version__ = "2.1.7"
33

44
from .transporter import SQLite3toMySQL

sqlite3_to_mysql/cli.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@
22
import os
33
import sys
44
import typing as t
5+
from datetime import datetime
56

67
import click
78
from mysql.connector import CharacterSet
89
from tabulate import tabulate
910

1011
from . import SQLite3toMySQL
12+
from . import __version__ as package_version
1113
from .click_utils import OptionEatAll, prompt_password
1214
from .debug_info import info
1315
from .mysql_utils import MYSQL_INSERT_METHOD, MYSQL_TEXT_COLUMN_TYPES, mysql_supported_character_sets
1416

1517

16-
@click.command()
18+
_copyright_header: str = f"sqlite3mysql version {package_version} Copyright (c) 2018-{datetime.now().year} Klemen Tusar"
19+
20+
21+
@click.command(
22+
name="sqlite3mysql",
23+
help=_copyright_header,
24+
no_args_is_help=True,
25+
epilog="For more information, visit https://github.com/techouse/sqlite3-to-mysql",
26+
)
1727
@click.option(
1828
"-f",
1929
"--sqlite-file",
@@ -140,6 +150,7 @@ def cli(
140150
debug: bool,
141151
) -> None:
142152
"""Transfer SQLite to MySQL using the provided CLI options."""
153+
click.echo(_copyright_header)
143154
try:
144155
if mysql_collation:
145156
charset_collations: t.Tuple[str, ...] = tuple(

tests/func/test_cli.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import typing as t
2+
from datetime import datetime
23
from random import choice, sample
34

45
import pytest
@@ -10,6 +11,7 @@
1011
from sqlalchemy.engine import Engine, Inspector
1112

1213
from sqlite3_to_mysql import SQLite3toMySQL
14+
from sqlite3_to_mysql import __version__ as package_version
1315
from sqlite3_to_mysql.cli import cli as sqlite3mysql
1416
from tests.conftest import MySQLCredentials
1517

@@ -19,12 +21,12 @@
1921
class TestSQLite3toMySQL:
2022
def test_no_arguments(self, cli_runner: CliRunner, mysql_database: Engine) -> None:
2123
result: Result = cli_runner.invoke(sqlite3mysql)
22-
assert result.exit_code > 0
23-
assert any(
24+
assert result.exit_code == 0
25+
assert all(
2426
message in result.output
2527
for message in {
26-
'Error: Missing option "-f" / "--sqlite-file"',
27-
"Error: Missing option '-f' / '--sqlite-file'",
28+
f"Usage: {sqlite3mysql.name} [OPTIONS]",
29+
f"{sqlite3mysql.name} version {package_version} Copyright (c) 2018-{datetime.now().year} Klemen Tusar",
2830
}
2931
)
3032

@@ -538,5 +540,9 @@ def test_quiet(
538540
sqlite3mysql,
539541
arguments,
540542
)
543+
print(result.output)
541544
assert result.exit_code == 0
542-
assert result.output == ""
545+
assert (
546+
f"{sqlite3mysql.name} version {package_version} Copyright (c) 2018-{datetime.now().year} Klemen Tusar"
547+
in result.output
548+
)

0 commit comments

Comments
 (0)