From 532672eee1e7278eda00e4ac24c7150f7b390862 Mon Sep 17 00:00:00 2001 From: bucolucas Date: Tue, 20 Aug 2024 17:51:55 -0500 Subject: [PATCH 1/2] Add PowerShell script to check dependencies and run tests - Created run_tests.ps1 to verify dependencies from requirements.txt, install missing ones, and run unit tests. --- run_tests.ps1 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 run_tests.ps1 diff --git a/run_tests.ps1 b/run_tests.ps1 new file mode 100644 index 0000000..2a130df --- /dev/null +++ b/run_tests.ps1 @@ -0,0 +1,30 @@ +# Check for and install missing dependencies +$requirementsFile = "requirements.txt" + +if (Test-Path $requirementsFile) { + Write-Output "Checking for dependencies in $requirementsFile ..." + $dependencies = Get-Content $requirementsFile + foreach ($dependency in $dependencies) { + $packageName = $dependency -split "==")[0] + if (-not (pip show $packageName)) { + Write-Output "Installing missing dependency: $packageName ..." + pip install $dependency + } else { + Write-Output "Dependency $packageName is already installed." + } + } + Write-Output "All dependencies are checked and installed." +} else { + Write-Output "Requirements file $requirementsFile not found. Skipping dependency checks." +} + +# Navigate to the tests directory and run tests +$testsDirectory = "tests/claude" +if (Test-Path $testsDirectory) { + Write-Output "Running tests in $testsDirectory ..." + Push-Location $testsDirectory + python -m unittest discover + Pop-Location +} else { + Write-Output "Tests directory $testsDirectory not found." +} \ No newline at end of file From 942e3013262e67a358f57a7c6c4ebed58b6cf736 Mon Sep 17 00:00:00 2001 From: bucolucas Date: Tue, 20 Aug 2024 17:53:26 -0500 Subject: [PATCH 2/2] Update run_tests.ps1 to run all tests across subdirectories - Modified the script to navigate to the `tests` directory and run all tests in all subdirectories. --- run_tests.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/run_tests.ps1 b/run_tests.ps1 index 2a130df..908047a 100644 --- a/run_tests.ps1 +++ b/run_tests.ps1 @@ -5,7 +5,7 @@ if (Test-Path $requirementsFile) { Write-Output "Checking for dependencies in $requirementsFile ..." $dependencies = Get-Content $requirementsFile foreach ($dependency in $dependencies) { - $packageName = $dependency -split "==")[0] + $packageName = ($dependency -split "==")[0] if (-not (pip show $packageName)) { Write-Output "Installing missing dependency: $packageName ..." pip install $dependency @@ -19,11 +19,11 @@ if (Test-Path $requirementsFile) { } # Navigate to the tests directory and run tests -$testsDirectory = "tests/claude" +$testsDirectory = "tests" if (Test-Path $testsDirectory) { - Write-Output "Running tests in $testsDirectory ..." + Write-Output "Running tests in $testsDirectory and all subdirectories ..." Push-Location $testsDirectory - python -m unittest discover + python -m unittest discover -s . -p "*.py" Pop-Location } else { Write-Output "Tests directory $testsDirectory not found."