Skip to content

Commit 4cea1dd

Browse files
committed
fixed failing test
1 parent fb00677 commit 4cea1dd

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

ellar_cli/main.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,19 @@ def version_callback(value: bool) -> None:
4242
@_typer.callback()
4343
def typer_callback(
4444
ctx: typer.Context,
45-
project: t.Optional[str] = typer.Option(
46-
None,
47-
"-p",
45+
project: str = typer.Option(
46+
"default",
4847
"--project",
4948
show_default=True,
5049
exists=True,
5150
help="Run Specific Command on a specific project",
5251
),
5352
version: t.Optional[bool] = typer.Option(
54-
...,
55-
"-v",
53+
False,
5654
"--version",
5755
callback=version_callback,
58-
is_flag=True,
5956
help="CLI Version",
57+
show_default=False,
6058
),
6159
) -> None:
6260
meta_: t.Optional[EllarCLIService] = EllarCLIService.import_project_meta(project)
@@ -69,11 +67,11 @@ def build_typers() -> t.Any: # pragma: no cover
6967
argv = list(sys.argv)
7068
options, args = getopt.getopt(
7169
argv[1:],
72-
"hpv:",
70+
"",
7371
["project=", "help", "version"],
7472
)
7573
for k, v in options:
76-
if k in ["-p", "--project"] and v:
74+
if k in ["--project"] and v:
7775
app_name = v
7876
except Exception as ex:
7977
click.echo(ex)

tests/test_build_typers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_build_typers_command_works_for_default_project(cli_runner):
2222
def test_build_typers_ellar_typer_for_specific_project_works():
2323
os.chdir(sample_app_path)
2424
result = subprocess.run(
25-
["ellar", "-p", "example_project_2", "db", "create-migration"],
25+
["ellar", "--project", "example_project_2", "db", "create-migration"],
2626
stdout=subprocess.PIPE,
2727
)
2828
assert result.returncode == 0
@@ -40,14 +40,14 @@ def test_build_typers_command_for_specific_project_works():
4040
os.chdir(sample_app_path)
4141

4242
result = subprocess.run(
43-
["ellar", "-p", "example_project", "whatever-you-want"],
43+
["ellar", "--project", "example_project", "whatever-you-want"],
4444
stdout=subprocess.PIPE,
4545
)
4646
assert result.returncode == 0
4747
assert result.stdout == b"Whatever you want command\n"
4848

4949
result = subprocess.run(
50-
["ellar", "-p", "example_project_2", "whatever-you-want"],
50+
["ellar", "--project", "example_project_2", "whatever-you-want"],
5151
stdout=subprocess.PIPE,
5252
)
5353
assert result.returncode == 0
@@ -60,12 +60,12 @@ def test_help_command(cli_runner):
6060
assert result.returncode == 0
6161

6262
result = subprocess.run(
63-
["ellar", "-p", "example_project", "--help"], stdout=subprocess.PIPE
63+
["ellar", "--project", "example_project", "--help"], stdout=subprocess.PIPE
6464
)
6565
assert result.returncode == 0
6666

6767
result = subprocess.run(
68-
["ellar", "-p", "example_project_2", "--help"], stdout=subprocess.PIPE
68+
["ellar", "--project", "example_project_2", "--help"], stdout=subprocess.PIPE
6969
)
7070
assert result.returncode == 0
7171

0 commit comments

Comments
 (0)