pytest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: BSD-3-Clause Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 added in v0.1.0

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

func RunBenchmarks added in v0.1.0

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

RunBenchmarks runs the benchmarks in the directory passed in

func RunScript added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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