Skip to content

Commit bcaa34b

Browse files
committed
💬 add copyright header
1 parent 62b3232 commit bcaa34b

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

mysql_to_sqlite3/__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 MySQL to SQLite 3."""
2-
__version__ = "2.1.7"
2+
__version__ = "2.1.8"
33

44
from .transporter import MySQLtoSQLite

mysql_to_sqlite3/cli.py

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

67
import click
78
from tabulate import tabulate
89

910
from . import MySQLtoSQLite
11+
from . import __version__ as package_version
1012
from .click_utils import OptionEatAll, prompt_password, validate_positive_integer
1113
from .debug_info import info
1214
from .sqlite_utils import CollatingSequences
1315

1416

15-
@click.command()
17+
_copyright_header: str = f"mysql2sqlite version {package_version} Copyright (c) 2019-{datetime.now().year} Klemen Tusar"
18+
19+
20+
@click.command(
21+
name="mysql2sqlite",
22+
help=_copyright_header,
23+
no_args_is_help=True,
24+
epilog="For more information, visit https://github.com/techouse/mysql-to-sqlite3",
25+
)
1626
@click.option(
1727
"-f",
1828
"--sqlite-file",
@@ -141,6 +151,7 @@ def cli(
141151
debug: bool,
142152
) -> None:
143153
"""Transfer MySQL to SQLite using the provided CLI options."""
154+
click.echo(_copyright_header)
144155
try:
145156
if mysql_tables and exclude_mysql_tables:
146157
raise click.UsageError("Illegal usage: --mysql-tables and --exclude-mysql-tables are mutually exclusive!")

tests/func/test_cli.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import typing as t
3+
from datetime import datetime
34
from random import choice, sample
45

56
import pytest
@@ -9,6 +10,7 @@
910
from sqlalchemy import Connection, Engine, Inspector, create_engine, inspect
1011

1112
from mysql_to_sqlite3 import MySQLtoSQLite
13+
from mysql_to_sqlite3 import __version__ as package_version
1214
from mysql_to_sqlite3.cli import cli as mysql2sqlite
1315
from tests.conftest import MySQLCredentials
1416
from tests.database import Database
@@ -19,12 +21,12 @@
1921
class TestMySQLtoSQLite:
2022
def test_no_arguments(self, cli_runner: CliRunner) -> None:
2123
result: Result = cli_runner.invoke(mysql2sqlite)
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: {mysql2sqlite.name} [OPTIONS]",
29+
f"{mysql2sqlite.name} version {package_version} Copyright (c) 2019-{datetime.now().year} Klemen Tusar",
2830
}
2931
)
3032

@@ -332,10 +334,14 @@ def test_minimum_valid_parameters(
332334
arguments.append("-q")
333335
result: Result = cli_runner.invoke(mysql2sqlite, arguments)
334336
assert result.exit_code == 0
337+
copyright_header = (
338+
f"{mysql2sqlite.name} version {package_version} Copyright (c) 2019-{datetime.now().year} Klemen Tusar\n"
339+
)
340+
assert copyright_header in result.output
335341
if quiet:
336-
assert result.output == ""
342+
assert result.output.replace(copyright_header, "") == ""
337343
else:
338-
assert result.output != ""
344+
assert result.output.replace(copyright_header, "") != ""
339345

340346
def test_keyboard_interrupt(
341347
self,

0 commit comments

Comments
 (0)