Skip to content

Commit

Permalink
💬 add copyright header
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Jan 13, 2024
1 parent 62b3232 commit bcaa34b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mysql_to_sqlite3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Utility to transfer data from MySQL to SQLite 3."""
__version__ = "2.1.7"
__version__ = "2.1.8"

from .transporter import MySQLtoSQLite
13 changes: 12 additions & 1 deletion mysql_to_sqlite3/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@
import os
import sys
import typing as t
from datetime import datetime

import click
from tabulate import tabulate

from . import MySQLtoSQLite
from . import __version__ as package_version
from .click_utils import OptionEatAll, prompt_password, validate_positive_integer
from .debug_info import info
from .sqlite_utils import CollatingSequences


@click.command()
_copyright_header: str = f"mysql2sqlite version {package_version} Copyright (c) 2019-{datetime.now().year} Klemen Tusar"


@click.command(
name="mysql2sqlite",
help=_copyright_header,
no_args_is_help=True,
epilog="For more information, visit https://github.com/techouse/mysql-to-sqlite3",
)
@click.option(
"-f",
"--sqlite-file",
Expand Down Expand Up @@ -141,6 +151,7 @@ def cli(
debug: bool,
) -> None:
"""Transfer MySQL to SQLite using the provided CLI options."""
click.echo(_copyright_header)
try:
if mysql_tables and exclude_mysql_tables:
raise click.UsageError("Illegal usage: --mysql-tables and --exclude-mysql-tables are mutually exclusive!")
Expand Down
18 changes: 12 additions & 6 deletions tests/func/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import typing as t
from datetime import datetime
from random import choice, sample

import pytest
Expand All @@ -9,6 +10,7 @@
from sqlalchemy import Connection, Engine, Inspector, create_engine, inspect

from mysql_to_sqlite3 import MySQLtoSQLite
from mysql_to_sqlite3 import __version__ as package_version
from mysql_to_sqlite3.cli import cli as mysql2sqlite
from tests.conftest import MySQLCredentials
from tests.database import Database
Expand All @@ -19,12 +21,12 @@
class TestMySQLtoSQLite:
def test_no_arguments(self, cli_runner: CliRunner) -> None:
result: Result = cli_runner.invoke(mysql2sqlite)
assert result.exit_code > 0
assert any(
assert result.exit_code == 0
assert all(
message in result.output
for message in {
'Error: Missing option "-f" / "--sqlite-file"',
"Error: Missing option '-f' / '--sqlite-file'",
f"Usage: {mysql2sqlite.name} [OPTIONS]",
f"{mysql2sqlite.name} version {package_version} Copyright (c) 2019-{datetime.now().year} Klemen Tusar",
}
)

Expand Down Expand Up @@ -332,10 +334,14 @@ def test_minimum_valid_parameters(
arguments.append("-q")
result: Result = cli_runner.invoke(mysql2sqlite, arguments)
assert result.exit_code == 0
copyright_header = (
f"{mysql2sqlite.name} version {package_version} Copyright (c) 2019-{datetime.now().year} Klemen Tusar\n"
)
assert copyright_header in result.output
if quiet:
assert result.output == ""
assert result.output.replace(copyright_header, "") == ""
else:
assert result.output != ""
assert result.output.replace(copyright_header, "") != ""

def test_keyboard_interrupt(
self,
Expand Down

0 comments on commit bcaa34b

Please sign in to comment.