Skip to content

Commit

Permalink
code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
kaliv0 committed Sep 19, 2024
1 parent f15bba7 commit 02acc72
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 141 deletions.
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ authors = [
description = "CLI tool for managing local file system storage"
name = "command-line-file-manager"
readme = "README.md"
version = "1.1.5"
license = { file = "LICENSE" }
version = "1.1.6"

requires-python = ">=3.10"

Expand All @@ -25,8 +26,6 @@ dev = [
"codespell == 2.2.6",
"black == 23.9.1",
"pytest == 7.4.2",
"coverage == 7.3.2",
"pytest-cov == 4.1.0",
"build == 1.0.3",
"twine == 4.0.2",
]
Expand Down
2 changes: 0 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
pytest==7.4.2
coverage==7.3.2
pytest-cov==4.1.0
135 changes: 0 additions & 135 deletions tests/test_organizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,141 +29,6 @@ def test_organize_files(runner, mock_organizer):
assert all(substring in log_message for substring in message_substrings)


def test_organize_files_recursively(runner, mock_organizer):
result = runner.invoke(commands.organize_files_recursively, [RESOURCE_DIR])
assert result.exit_code == 0

log_message = _cleanup_abs_paths(result)
message_substrings = (
"----- Inside tests/resources/plain/ -----\n",
"Skipping .hidden_file.md\n",
"Creating folder tests/resources/plain/docs\n",
"Moving file.txt to tests/resources/plain/docs\n",
"Creating folder tests/resources/plain/music\n",
"Moving audio1.wav to tests/resources/plain/music\n",
"Skipping .hidden_other directory\n",
"Creating folder tests/resources/plain/books\n",
"Moving file1.pdf to tests/resources/plain/books\n",
"Creating folder tests/resources/plain/images\n",
"Moving pic1.jpg to tests/resources/plain/images\n",
"Creating folder tests/resources/plain/videos\n",
"Moving video.mp4 to tests/resources/plain/videos\n",
"Creating folder tests/resources/plain/images\n",
"Moving pic.png to tests/resources/plain/images\n",
"Creating folder tests/resources/plain/other\n",
"Moving smth.md to tests/resources/plain/other\n",
"----- Inside tests/resources/plain/inner_test -----\n",
"Skipping .inner_hidden_alone.wav\n",
"Creating folder tests/resources/plain/inner_test/images\n",
"Moving inner_pic1.jpg to tests/resources/plain/inner_test/images\n",
"Creating folder tests/resources/plain/inner_test/videos\n",
"Moving inner_audio.mp4 to tests/resources/plain/inner_test/videos\n",
"Creating folder tests/resources/plain/inner_test/other\n",
"Moving inner_smth.md to tests/resources/plain/inner_test/other\n",
"Creating folder tests/resources/plain/inner_test/books\n",
"Moving inner_file1.pdf to tests/resources/plain/inner_test/books\n"
"Creating folder tests/resources/plain/inner_test/images\n",
"Moving inner_pic.png to tests/resources/plain/inner_test/images\n"
"Creating folder tests/resources/plain/inner_test/music\n",
"Moving inner_audio1.wav to tests/resources/plain/inner_test/music\n",
"Creating folder tests/resources/plain/inner_test/docs\n",
"Moving inner_file.txt to tests/resources/plain/inner_test/docs\n",
"Skipping .inner_hidden directory\n",
"----- Inside tests/resources/plain/inner_test/most_inner_test -----\n",
"Creating folder tests/resources/plain/inner_test/most_inner_test/other\n",
"Moving most_inner_smth.md to ",
"tests/resources/plain/inner_test/most_inner_test/other\n",
"Creating folder tests/resources/plain/inner_test/most_inner_test/images\n",
"Moving most_inner_pic1.jpg to ",
"tests/resources/plain/inner_test/most_inner_test/images\n",
"Creating folder tests/resources/plain/inner_test/most_inner_test/images\n",
"Moving most_inner_pic.png to ",
"tests/resources/plain/inner_test/most_inner_test/images\n",
"Moving most_inner_audio1.wav to ",
"tests/resources/plain/inner_test/most_inner_test/music\n",
"Creating folder tests/resources/plain/inner_test/most_inner_test/docs\n",
"Moving most_inner_file.txt to ",
"tests/resources/plain/inner_test/most_inner_test/docs\n",
"Creating folder tests/resources/plain/inner_test/most_inner_test/videos\n",
"Moving most_inner_audio.mp4 to ",
"tests/resources/plain/inner_test/most_inner_test/videos\n",
"Creating folder tests/resources/plain/inner_test/most_inner_test/books\n",
"Moving most_inner_file1.pdf to ",
"tests/resources/plain/inner_test/most_inner_test/books\n",
"----- Inside tests/resources/plain/inner_test/most_inner_test/music -----\n",
"Creating folder tests/resources/plain/inner_test/most_inner_test/music/music\n",
"Moving inside_most_inner_audio.wav to ",
"tests/resources/plain/inner_test/most_inner_test/music/music\n",
)

assert all(substring in log_message for substring in message_substrings)


def test_organize_files_recursively_and_flatten_folder(runner, mock_organizer):
result = runner.invoke(commands.organize_files_recursively, [RESOURCE_DIR, "--flat"])
assert result.exit_code == 0

log_message = _cleanup_abs_paths(result)
message_substrings = (
"----- Inside tests/resources/plain/ -----\n",
"Moving .hidden_file.md to root directory\n",
"Creating folder tests/resources/plain/docs\n",
"Moving file.txt to tests/resources/plain/docs\n",
"Creating folder tests/resources/plain/music\n",
"Moving audio1.wav to tests/resources/plain/music\n",
"Moving .hidden_other directory without stepping inside\n",
"Creating folder tests/resources/plain/books\n",
"Moving file1.pdf to tests/resources/plain/books\n",
"Creating folder tests/resources/plain/images\n",
"Moving pic1.jpg to tests/resources/plain/images\n",
"Creating folder tests/resources/plain/videos\n",
"Moving video.mp4 to tests/resources/plain/videos\n",
"Creating folder tests/resources/plain/images\n",
"Moving pic.png to tests/resources/plain/images\n",
"Creating folder tests/resources/plain/other\n",
"Moving smth.md to tests/resources/plain/other\n",
"----- Inside tests/resources/plain/inner_test -----\n",
"Moving .inner_hidden_alone.wav to root directory\n"
"Creating folder tests/resources/plain/images\n",
"Moving inner_pic1.jpg to tests/resources/plain/images\n",
"Creating folder tests/resources/plain/videos\n",
"Moving inner_audio.mp4 to tests/resources/plain/videos\n",
"Creating folder tests/resources/plain/other\n",
"Moving inner_smth.md to tests/resources/plain/other\n",
"Creating folder tests/resources/plain/books\n",
"Moving inner_file1.pdf to tests/resources/plain/books\n",
"Creating folder tests/resources/plain/images\n",
"Moving inner_pic.png to tests/resources/plain/images\n",
"Creating folder tests/resources/plain/music\n",
"Moving inner_audio1.wav to tests/resources/plain/music\n",
"Creating folder tests/resources/plain/docs\n",
"Moving inner_file.txt to tests/resources/plain/docs\n",
"Moving .inner_hidden directory without stepping inside\n",
"----- Inside tests/resources/plain/inner_test/most_inner_test -----\n",
"Creating folder tests/resources/plain/other\n",
"Moving most_inner_smth.md to tests/resources/plain/other\n",
"Creating folder tests/resources/plain/images\n"
"Moving most_inner_pic1.jpg to tests/resources/plain/images\n",
"Creating folder tests/resources/plain/images\n",
"Moving most_inner_pic.png to tests/resources/plain/images\n"
"Creating folder tests/resources/plain/music\n",
"Moving most_inner_audio1.wav to tests/resources/plain/music\n",
"Creating folder tests/resources/plain/docs\n",
"Moving most_inner_file.txt to tests/resources/plain/docs\n",
"Creating folder tests/resources/plain/videos\n",
"Moving most_inner_audio.mp4 to tests/resources/plain/videos\n",
"Creating folder tests/resources/plain/books\n"
"Moving most_inner_file1.pdf to tests/resources/plain/books\n",
"----- Inside tests/resources/plain/inner_test/most_inner_test/music -----\n",
"Creating folder tests/resources/plain/music\n",
"Moving inside_most_inner_audio.wav to tests/resources/plain/music\n",
"Removing tests/resources/plain/inner_test/most_inner_test/music\n",
"Removing tests/resources/plain/inner_test/most_inner_test\n"
"Removing tests/resources/plain/inner_test\n",
)
assert all(substring in log_message for substring in message_substrings)


def test_handle_duplicate_files(runner, mock_organizer):
result = runner.invoke(commands.handle_duplicate_files, [DUPLICATES_RESOURCE_DIR])
assert result.exit_code == 0
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ commands = black --line-length 100 .
[testenv:test]
deps = -rrequirements.txt
-rtest-requirements.txt
commands = pytest -vv --disable-warnings --cov-branch -s --cache-clear --cov=app --cov-fail-under=75
commands = pytest -vv --disable-warnings -s --cache-clear

0 comments on commit 02acc72

Please sign in to comment.