2024-08-20 17:51:55 -05:00
|
|
|
# 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) {
|
2024-08-20 17:53:26 -05:00
|
|
|
$packageName = ($dependency -split "==")[0]
|
2024-08-20 17:51:55 -05:00
|
|
|
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
|
2024-08-20 17:53:26 -05:00
|
|
|
$testsDirectory = "tests"
|
2024-08-20 17:51:55 -05:00
|
|
|
if (Test-Path $testsDirectory) {
|
2024-08-20 17:53:26 -05:00
|
|
|
Write-Output "Running tests in $testsDirectory and all subdirectories ..."
|
2024-08-20 17:51:55 -05:00
|
|
|
Push-Location $testsDirectory
|
2024-08-20 17:53:26 -05:00
|
|
|
python -m unittest discover -s . -p "*.py"
|
2024-08-20 17:51:55 -05:00
|
|
|
Pop-Location
|
|
|
|
|
} else {
|
|
|
|
|
Write-Output "Tests directory $testsDirectory not found."
|
|
|
|
|
}
|