feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
package generators
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
2026-03-26 17:41:53 +00:00
|
|
|
|
|
|
|
|
"dappco.re/go/core/build/internal/ax"
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
)
|
|
|
|
|
|
2026-03-26 17:41:53 +00:00
|
|
|
func TestPython_PythonGeneratorAvailable_Good(t *testing.T) {
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
g := NewPythonGenerator()
|
|
|
|
|
|
|
|
|
|
// These should not panic
|
|
|
|
|
lang := g.Language()
|
|
|
|
|
if lang != "python" {
|
|
|
|
|
t.Errorf("expected language 'python', got '%s'", lang)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_ = g.Available()
|
|
|
|
|
|
|
|
|
|
install := g.Install()
|
|
|
|
|
if install == "" {
|
|
|
|
|
t.Error("expected non-empty install instructions")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-26 17:41:53 +00:00
|
|
|
func TestPython_PythonGeneratorGenerate_Good(t *testing.T) {
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
g := NewPythonGenerator()
|
|
|
|
|
if !g.Available() && !dockerAvailable() {
|
|
|
|
|
t.Skip("no Python generator available (neither native nor docker)")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create temp directories
|
|
|
|
|
tmpDir := t.TempDir()
|
|
|
|
|
specPath := createTestSpec(t, tmpDir)
|
2026-03-26 17:41:53 +00:00
|
|
|
outputDir := ax.Join(tmpDir, "output")
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
|
|
|
|
|
opts := Options{
|
|
|
|
|
SpecPath: specPath,
|
|
|
|
|
OutputDir: outputDir,
|
|
|
|
|
PackageName: "testclient",
|
|
|
|
|
Version: "1.0.0",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
err := g.Generate(ctx, opts)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("Generate failed: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Verify output directory was created
|
2026-03-26 17:41:53 +00:00
|
|
|
if !ax.Exists(outputDir) {
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
t.Error("output directory was not created")
|
|
|
|
|
}
|
|
|
|
|
}
|