Commit 61e77f8c authored by Grant, Josh's avatar Grant, Josh
Browse files

update and add in some tests

parents dd6081df 61f1f1d1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
common-package = {editable = true, path = "./src", extras = ["scrapers"]}
common-package = {editable = true, path = "./src", extras = ["dev", "minio", "cli"]}
twine = "*"

[dev-packages]
@@ -15,6 +15,7 @@ flake8 = "*"
pylint = "*"
tox = "*"
twine = "*"
moto = {extras = ["all"], version = "*"}

[scripts]
lint = "tox -e lint"
+1710 −587

File changed.

Preview size limit exceeded, changes collapsed.

+4 −4
Original line number Diff line number Diff line
version: '3.7'
version: "3.7"

services:
  package:
@@ -10,8 +10,8 @@ services:
      - ./test_envfile
    #command: ["sh", "-c", "pytest --cov=common /test/test.py"]
    #command: ["sh", "-c", "test-db-conn && pytest -v --cov=common /test/test.py"]
    command: ["sh", "-c", "test-db-conn && python3 /test/test.py"]
    #command: tail -f /dev/null
    #command: ["sh", "-c", "test-db-conn && python3 /test/test.py"]
    command: tail -f /dev/null
    depends_on:
      - postgres

+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ def of_cli():
# noqa: PEP402
from common.cli.docker_cli import docker
from common.cli.python_cli import python_cli

from common.cli.gen_cli import gen_cli

of_cli.add_command(docker)
of_cli.add_command(python_cli)
+38 −0
Original line number Diff line number Diff line
"""Command line arguments for helping generate file sizes."""

import click

from common.gen import generate_csv, convert_size_to_bytes


@click.group()
def gen_cli():
    """A CLI to generate large CSV files with random data."""
    pass


@gen_cli.command()
@click.option('--col', '-c', type=int, required=True, help="Number of columns in the CSV.")
@click.option('--row', '-r', type=int, help="Number of rows in the CSV.")
@click.option('--size', '-s', type=str, help="Target file size (e.g., 512MB or 1GB).")
def generate(col, row, size):
    """Generate a CSV file with the specified number of columns and rows or file size."""
    target_file_size = None
    if size:
        try:
            target_file_size = convert_size_to_bytes(size)
        except ValueError as e:
            click.echo(f"Error: {e}")
            return

    generate_csv(
        file_path='output.csv',
        n_columns=col,
        target_row_count=row,
        target_file_size=target_file_size,
        column_types={}  # You can define the column types here if needed
    )


if __name__ == '__main__':
    gen_cli()
Loading