Add client path to sys.path and run repository from code

- Added client path to sys.path in conftest.py
- Implemented function to run the repository from code in manage.ps1
This commit is contained in:
Jakub Jezek 2024-09-25 16:06:24 +02:00
parent 885f8acd2b
commit 2980f10040
No known key found for this signature in database
GPG key ID: 06DBD609ADF27FD9
2 changed files with 20 additions and 0 deletions

9
tests/conftest.py Normal file
View file

@ -0,0 +1,9 @@
import sys
from pathlib import Path
client_path = Path(__file__).resolve().parent.parent / "client"
# add client path to sys.path
sys.path.append(str(client_path))
print(f"Added {client_path} to sys.path")

View file

@ -233,6 +233,13 @@ function Invoke-Codespell {
& $Poetry $CodespellArgs
}
function Run-From-Code {
$Poetry = "$RepoRoot\.poetry\bin\poetry.exe"
$RunArgs = @( "run")
& $Poetry $RunArgs @arguments
}
function Write-Help {
<#
.SYNOPSIS
@ -248,6 +255,7 @@ function Write-Help {
Write-Info -Text " ruff-check ", "Run Ruff check for the repository" -Color White, Cyan
Write-Info -Text " ruff-fix ", "Run Ruff fix for the repository" -Color White, Cyan
Write-Info -Text " codespell ", "Run codespell check for the repository" -Color White, Cyan
Write-Info -Text " run ", "Run the repository" -Color White, Cyan
Write-Host ""
}
@ -269,6 +277,9 @@ function Resolve-Function {
} elseif ($FunctionName -eq "codespell") {
Set-Cwd
Invoke-CodeSpell
} elseif ($FunctionName -eq "run") {
Set-Cwd
Run-From-Code
} else {
Write-Host "Unknown function ""$FunctionName"""
Write-Help