From 527cac05e455829300e505349a4bc2db21b79ec1 Mon Sep 17 00:00:00 2001 From: Elkin Aguas Date: Sat, 11 Nov 2023 18:10:44 +0100 Subject: [PATCH 1/2] Tests first commit --- tests/add_command.py | 0 tests/init_clir.py | 20 ++++++++++++++++++++ tests/list_command.py | 0 tests/remove_command.py | 0 tests/run_command.py | 0 5 files changed, 20 insertions(+) create mode 100644 tests/add_command.py create mode 100644 tests/init_clir.py create mode 100644 tests/list_command.py create mode 100644 tests/remove_command.py create mode 100644 tests/run_command.py diff --git a/tests/add_command.py b/tests/add_command.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/init_clir.py b/tests/init_clir.py new file mode 100644 index 0000000..b9e9452 --- /dev/null +++ b/tests/init_clir.py @@ -0,0 +1,20 @@ +import os +import subprocess + +subprocess.run(['clir', 'init'], capture_output=True, text=True) +dir_path = os.path.expanduser('~/.clir') +file_path = os.path.expanduser('~/.clir/commands.json') +command_file_creation_time = os.path.getctime(file_path) + +# Test if the clir folder environment was created +def test_clir_project_folder_created(): + assert os.path.exists(dir_path) + +# Test if the commands.json file was created +def test_command_file_created(): + assert os.path.exists(file_path) + +# Test if init command doesn't recreate the commands.json file +def test_init_command_doesnt_recreate_commands_json(): + subprocess.run(['clir', 'init'], capture_output=True, text=True) + assert os.path.getctime(file_path) == command_file_creation_time \ No newline at end of file diff --git a/tests/list_command.py b/tests/list_command.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/remove_command.py b/tests/remove_command.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/run_command.py b/tests/run_command.py new file mode 100644 index 0000000..e69de29 From ea8069a44f2449c356e68e98c8902914d20f6c84 Mon Sep 17 00:00:00 2001 From: Elkin Aguas Date: Sat, 11 Nov 2023 18:11:23 +0100 Subject: [PATCH 2/2] Update poetry lock --- poetry.lock | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 544d5eb..9bd350f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -115,6 +115,26 @@ typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9 [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] +[[package]] +name = "rich-click" +version = "1.7.1" +description = "Format click help output nicely with rich" +optional = false +python-versions = ">=3.7" +files = [ + {file = "rich-click-1.7.1.tar.gz", hash = "sha256:660c8ea345343f47c5de88f62afa34a19d9f4c7accdd9c6e39dc17eece6affcd"}, + {file = "rich_click-1.7.1-py3-none-any.whl", hash = "sha256:c37d19af85c86b9a256c18e9d23637ae89478300ec8dc5e220c6ca213675f2f9"}, +] + +[package.dependencies] +click = ">=7" +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} +rich = ">=10.7.0" +typing-extensions = "*" + +[package.extras] +dev = ["flake8", "flake8-docstrings", "mypy", "packaging", "pre-commit", "pytest", "pytest-cov", "types-setuptools"] + [[package]] name = "typing-extensions" version = "4.7.1" @@ -144,4 +164,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "b58c309c5b36fb222672604ccdee62fc1e1a69aff32eda85ce6dabedafc228e3" +content-hash = "3b3e9c2206575a8f9f1e1e3173b22d1d0aeb6e0f838179ab878f19fc16d1a92a"