pytest

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegenTestData = flag.Bool("regen", false, "Regenerate golden files from current testdata.")

Functions

func CompileSrc

func CompileSrc(t testing.TB, ctx py.Context, pySrc string, prog string) (*py.Module, *py.Code)

func RunBenchmarks

func RunBenchmarks(b *testing.B, testDir string)

RunBenchmarks runs the benchmarks in the directory passed in

func RunScript

func RunScript(t *testing.T, fname string)

RunScript runs the provided path to a script. RunScript captures the stdout and stderr while executing the script and compares it to a golden file, blocking until completion.

RunScript("./testdata/foo.py")

will compare the output with "./testdata/foo_golden.txt".

func RunTestTasks

func RunTestTasks(t *testing.T, tasks []*Task)

RunTestTasks runs each given task in a newly created py.Context concurrently. If a fatal error is encountered, the given testing.T is signaled.

func RunTests

func RunTests(t *testing.T, testDir string)

RunTests runs the tests in the directory passed in

Types

type Task

type Task struct {
	ID       string                     // unique key identifying this task.  If empty, autogenerated from the basename of PyFile
	PyFile   string                     // If set, this file pathname is executed in a newly created ctx
	PyTask   func(ctx py.Context) error // If set, a new created ctx is created and this blocks until completion
	GoldFile string                     // Filename containing the "gold standard" stdout+stderr.  If empty, autogenerated from PyFile or ID
	Err      error                      // Non-nil if a fatal error is encountered with this task
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL