Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Dependency management redux, closes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
rednafi committed Jun 27, 2023
1 parent 20f10d9 commit 3497168
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
4 changes: 0 additions & 4 deletions rubric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def copy_over(
overwrite: bool = False,
append: bool = False,
) -> None:

"""
This function takes 'src_filename' and 'dst_dirname' where they mean
source file name and destination directory name respectively.
Expand Down Expand Up @@ -59,7 +58,6 @@ def copy_over(
# as a CLI.
with importlib.resources.open_text("rubric.files", src_filename) as src_file:
with open(dst_filepath, open_mode) as dst_file:

if open_mode == "w+":
if overwrite:
print(f"Overwriting {src_filename}...")
Expand Down Expand Up @@ -140,7 +138,6 @@ def orchestrator(
append: bool = False,
show: bool = False,
) -> None:

"""
Display / Create / Overwrite / Append to the files listed
in the 'FILENAMES' iterable.
Expand Down Expand Up @@ -234,7 +231,6 @@ def cli(
append: bool,
show: bool,
) -> None:

# Display help text when there's no flag.
if not any((list, create, overwrite, append, show)):
display_help(ctx, None, True)
Expand Down
19 changes: 6 additions & 13 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ def test_copy_over_append(create_file):
assert "tool.ruff" in file.read_text()


@pytest.mark.parametrize("filename", ["pyproject.toml", "README.md"])
@pytest.mark.parametrize(
"filename", ["pyproject.toml", "README.md"]
)
@pytest.mark.parametrize(
"overwrite, append",
("overwrite", "append"),
[(False, False), (True, False), (False, True), (True, True)],
)
def test_orcherstrator(create_file, overwrite, append):
Expand All @@ -112,16 +110,13 @@ def test_orcherstrator(create_file, overwrite, append):
)


@pytest.mark.parametrize(
"filename", ["pyproject.toml", "README.md"]
)
@pytest.mark.parametrize("overwrite, append", [(True, False)])
@pytest.mark.parametrize("filename", ["pyproject.toml", "README.md"])
@pytest.mark.parametrize(("overwrite", "append"), [(True, False)])
def test_orcherstrator_overwrite(
create_file,
overwrite,
append,
):

file = create_file
directory = file.parent
file.write_text("Lorem ipsum!")
Expand Down Expand Up @@ -151,10 +146,8 @@ def test_orcherstrator_overwrite(
assert "Lorem ipsum!" not in file.read_text()


@pytest.mark.parametrize(
"filename", ["pyproject.toml", "README.md"]
)
@pytest.mark.parametrize("overwrite, append", [(False, True)])
@pytest.mark.parametrize("filename", ["pyproject.toml", "README.md"])
@pytest.mark.parametrize(("overwrite", "append"), [(False, True)])
def test_orcherstrator_append(create_file, overwrite, append):
file = create_file
directory = file.parent
Expand Down
1 change: 0 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def test_cli_version():
autospec=True,
return_value="version: 0.0.0\n",
):

runner = CliRunner()
result = runner.invoke(rubric.cli, ["--version"])
assert result.exit_code == 0
Expand Down

0 comments on commit 3497168

Please sign in to comment.