Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 33 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build & Test Python Package

on:
push:
branches:
- main
paths:
- '**.yml'
- '**.py'
- pyproject.toml
- '**.sh'
- '**.html'

jobs:
run-performance-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Hatch
run: pip install hatch

- name: Install dependencies
run: hatch env create dev

- name: Run performance tests
run: hatch run dev:perftest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ results/
oc_output.html
atest/testdoc_output/**
atest/mkdocs_test/**
atest/mkdocs_test_perf/**
atest/mkdocs_test_custom/**
docs/mkdocs/site/**
49 changes: 19 additions & 30 deletions atest/test_cli.py → atest/acceptance/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,20 @@ def test_cli_help():
assert "Welcome" in result.output

def test_cli_cmd():
current_dir = os.path.dirname(os.path.abspath(__file__))
robot = os.path.join(current_dir, "test_cli.robot")
output = os.path.join(current_dir, "output_classic.html")
parent_dir = Path(__file__).parent.parent
robot = os.path.join(parent_dir, "testdata", "acceptance")
output = os.path.join(parent_dir, "output_classic.html")
runner = CliRunner()
result = runner.invoke(main, [robot, output])
assert result.exit_code == 0
assert "Generated" in result.output
assert "output_classic.html" in result.output
assert os.path.exists(output)

def test_cli_cmd_big_suite():
current_dir = os.path.dirname(os.path.abspath(__file__))
robot = os.path.join(current_dir)
output = os.path.join(current_dir, "output_big.html")
runner = CliRunner()
result = runner.invoke(main, [robot, output])
assert result.exit_code == 0
assert "Generated" in result.output
assert "output_big.html" in result.output
assert os.path.exists(output)

def test_cli_cmd_mkdocs():
current_dir = os.path.dirname(os.path.abspath(__file__))
robot = os.path.join(current_dir)
output = os.path.join(current_dir, "mkdocs_test")
parent_dir = Path(__file__).parent.parent
robot = os.path.join(parent_dir, "testdata", "acceptance")
output = os.path.join(parent_dir, "mkdocs_test")
if Path(output).exists():
shutil.rmtree(output)
os.mkdir(output)
Expand All @@ -48,9 +37,9 @@ def test_cli_cmd_mkdocs():
assert os.path.exists(os.path.join(output, "testdoc_output"))

def test_cli_cmd_github_prefix():
current_dir = os.path.dirname(os.path.abspath(__file__))
robot = os.path.join(current_dir)
output = os.path.join(current_dir, "output_big.html")
parent_dir = Path(__file__).parent.parent
robot = os.path.join(parent_dir, "testdata", "acceptance")
output = os.path.join(parent_dir, "output_big.html")
runner = CliRunner()
result = runner.invoke(main, ["-s", "github::https://github.com/project-name", "--verbose", robot, output])
assert result.exit_code == 0
Expand All @@ -60,9 +49,9 @@ def test_cli_cmd_github_prefix():
assert os.path.exists(output)

def test_cli_cmd_gitlab_prefix():
current_dir = os.path.dirname(os.path.abspath(__file__))
robot = os.path.join(current_dir)
output = os.path.join(current_dir, "output_big.html")
parent_dir = Path(__file__).parent.parent
robot = os.path.join(parent_dir, "testdata", "acceptance")
output = os.path.join(parent_dir, "output_big.html")
runner = CliRunner()
result = runner.invoke(main, ["-s", "gitlab::https://gitlab.com/project-name", "--verbose", robot, output])
assert result.exit_code == 0
Expand All @@ -72,10 +61,10 @@ def test_cli_cmd_gitlab_prefix():
assert os.path.exists(output)

def test_cli_cmd_mkdocs_custom_template():
current_dir = os.path.dirname(os.path.abspath(__file__))
robot = os.path.join(current_dir)
output = os.path.join(current_dir, "mkdocs_test_custom")
templ_dir = Path(__file__).parent.parent / "examples" / "mkdocs" / "default"
parent_dir = Path(__file__).parent.parent
robot = os.path.join(parent_dir, "testdata", "acceptance")
output = os.path.join(parent_dir, "mkdocs_test_custom")
templ_dir = Path(__file__).parent.parent.parent / "examples" / "mkdocs" / "default"
if Path(output).exists():
shutil.rmtree(output)
os.mkdir(output)
Expand All @@ -88,9 +77,9 @@ def test_cli_cmd_mkdocs_custom_template():


def test_cli_cmd_verbose():
current_dir = os.path.dirname(os.path.abspath(__file__))
robot = os.path.join(current_dir, "test_cli.robot")
output = os.path.join(current_dir, "output.html")
parent_dir = Path(__file__).parent.parent
robot = os.path.join(parent_dir, "testdata", "acceptance")
output = os.path.join(parent_dir, "output.html")
runner = CliRunner()
result = runner.invoke(main, [robot, output, "-v"])
assert result.exit_code == 0
Expand Down
16 changes: 0 additions & 16 deletions atest/config/config_with_colors.toml

This file was deleted.

10 changes: 0 additions & 10 deletions atest/config/testdoc.toml

This file was deleted.

32 changes: 0 additions & 32 deletions atest/config_pyproject/example_pyproject.toml

This file was deleted.

19 changes: 19 additions & 0 deletions atest/performance/test_performance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
from pathlib import Path
import shutil
from click.testing import CliRunner
from testdoc.cli import main

def test_cli_cmd_mkdocs_performance():
parent_dir = Path(__file__).parent.parent
robot = os.path.join(parent_dir, "testdata", "performance", "tests")
output = os.path.join(parent_dir, "mkdocs_test_perf")
if Path(output).exists():
shutil.rmtree(output)
os.mkdir(output)
runner = CliRunner()
result = runner.invoke(main, ["--mkdocs", robot, output])
assert result.exit_code == 0
assert "Generated mkdocs pages here" in result.stdout
assert output in result.stdout
assert os.path.exists(os.path.join(output, "testdoc_output"))
15 changes: 0 additions & 15 deletions atest/second_test_cli.robot

This file was deleted.

32 changes: 0 additions & 32 deletions atest/test_cli.robot

This file was deleted.

Loading