From 78e14b996f34047b2be85cf2a3d9ace1cac0821a Mon Sep 17 00:00:00 2001 From: Jonathan Cubides Date: Tue, 15 Oct 2024 19:44:49 -0500 Subject: [PATCH] Remove outdated tests --- .github/workflows/ci.yml | 10 +--- test/test_cli.py | 107 --------------------------------------- 2 files changed, 2 insertions(+), 115 deletions(-) delete mode 100644 test/test_cli.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ceb352..4e664d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,17 +41,14 @@ jobs: path: .juvix-build restore-keys: | juvix-cache- - - name: Install Python uses: actions/setup-python@v5.2.0 with: python-version: ${{ env.PYTHON_VERSION }} - - name: Install Poetry uses: abatilo/actions-poetry@v3.0.0 with: poetry-version: ${{ env.POETRY_VERSION }} - - name: Cache .cache uses: actions/cache@v4.0.2 with: @@ -59,22 +56,19 @@ jobs: path: .cache restore-keys: | mkdocs-material- - - name: Install Linux dependencies run: sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant graphviz - - name: Install Python dependencies run: poetry install - + - name: Run test + run: poetry run pytest - name: Create MkDocs Project run: | juvix-mkdocs new -f -n --no-run-server --no-open --project-name my-juvix-project - - name: Build MkDocs Project run: juvix-mkdocs build -p my-juvix-project env: SITE_URL: https://anoma.github.io/juvix-mkdocs - - if: success() uses: JamesIves/github-pages-deploy-action@v4.6.4 with: diff --git a/test/test_cli.py b/test/test_cli.py deleted file mode 100644 index 6e5c1d4..0000000 --- a/test/test_cli.py +++ /dev/null @@ -1,107 +0,0 @@ -import os -import shutil -from pathlib import Path - -from click.testing import CliRunner - -from src.cli import new - - -def test_new_command(): - runner = CliRunner() - with runner.isolated_filesystem(): - project_name = "test_project" - result = runner.invoke( - new, - [ - "--project-name", - project_name, - "--description", - "Test project description", - "--font-text", - "Inter", - "--font-code", - "Fira Code", - "--theme", - "material", - "--site-dir", - "documentation", - "--site-author", - "Test Author", - "--site-author-email", - "test@example.com", - "--force", - "--no-juvix-package", - "--no-everything", - "--no-github-actions", - ], - ) - - assert result.exit_code == 0 - assert f"Project '{project_name}' initialized successfully!" in result.output - - project_path = Path(project_name) - assert project_path.exists() - assert (project_path / "mkdocs.yml").exists() - assert (project_path / ".gitignore").exists() - assert (project_path / "README.md").exists() - assert (project_path / "pyproject.toml").exists() - assert (project_path / "documentation").exists() - assert (project_path / "documentation" / "index.juvix.md").exists() - assert (project_path / "documentation" / "test.juvix.md").exists() - assert not (project_path / "documentation" / "everything.juvix.md").exists() - assert not (project_path / ".github" / "workflows" / "ci.yml").exists() - - # Clean up - shutil.rmtree(project_path) - - -def test_new_command_existing_directory(): - runner = CliRunner() - with runner.isolated_filesystem(): - project_name = "existing_project" - os.mkdir(project_name) - - result = runner.invoke(new, ["--project-name", project_name]) - - assert result.exit_code == 0 - assert ( - f"Directory '{project_name}' already exists. Try -f to force overwrite." - in result.output - ) - - -def test_new_command_force_overwrite(): - runner = CliRunner() - with runner.isolated_filesystem(): - project_name = "force_overwrite_project" - os.mkdir(project_name) - (Path(project_name) / "existing_file.txt").write_text( - "This file should be removed" - ) - - result = runner.invoke(new, ["--project-name", project_name, "--force"]) - - assert result.exit_code == 0 - assert f"Project '{project_name}' initialized successfully!" in result.output - assert not (Path(project_name) / "existing_file.txt").exists() - - # Clean up - shutil.rmtree(project_name) - - -def test_new_command_with_everything_and_github_actions(): - runner = CliRunner() - with runner.isolated_filesystem(): - project_name = "full_project" - result = runner.invoke(new, ["--project-name", project_name, "--force"]) - - assert result.exit_code == 0 - assert f"Project '{project_name}' initialized successfully!" in result.output - - project_path = Path(project_name) - assert (project_path / "docs" / "everything.juvix.md").exists() - assert (project_path / ".github" / "workflows" / "ci.yml").exists() - - # Clean up - shutil.rmtree(project_path)