workspace#

class Session(name: str, cases: list[_canary.testcase.TestCase], prefix: pathlib.Path)#

Bases: object

name: str#
cases: list[TestCase]#
prefix: Path#
returncode: int = -1#
started_on: datetime = datetime.datetime(1, 1, 1, 0, 0)#
finished_on: datetime = datetime.datetime(1, 1, 1, 0, 0)#
run(workspace: Workspace) None#
class Workspace(anchor: str | Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/canary-wm/checkouts/release-26.4.16/docs/source'))#

Bases: object

version_info = (1, 0, 0)#
root: Path#
view: Path | None#
refs_dir: Path#
sessions_dir: Path#
cache_dir: Path#
tmp_dir: Path#
logs_dir: Path#
head: Path#
db: WorkspaceDatabase#
canary_level: int#
initialize_properties(*, anchor: Path) None#
static remove(start: str | Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/canary-wm/checkouts/release-26.4.16/docs/source')) Path | None#
rmf() None#
static find_anchor(start: str | Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/canary-wm/checkouts/release-26.4.16/docs/source')) Path | None#
static find_workspace(start: str | Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/canary-wm/checkouts/release-26.4.16/docs/source')) Path | None#
classmethod create(path: str | Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/canary-wm/checkouts/release-26.4.16/docs/source'), force: bool = False) Workspace#
classmethod load(start: str | Path | None = None) Workspace#
run(specs: list[ResolvedSpec], session: str | None = None, reuse_latest_session: bool = False, update_view: bool = True, only: str = 'not_pass') Session#
add_session_results(session: Session, update_view: bool = True) None#

Update latest results, view, and refs with results from session

rebuild_view() None#

Keep only the latet results

update_view(view_entries: list[tuple[Path, str]]) None#
relative_to_view(path: str | PathLike[str]) str | None#

If path is inside TestResults, return the relative path (which may include glob characters). Otherwise return None.

Examples

/ws/TestResults/foo/bar/test.py -> foo/bar/test.py

is_session_dir(path: str | PathLike[str]) bool#
info() dict[str, Any]#
collect(scanpaths: dict[str, list[str]], on_options: list[str] | None = None) list[ResolvedSpec]#

Find test case generators in scan_paths and add them to this workspace

store_specs(specs: list[ResolvedSpec]) None#
select(tag: str, prefixes: list[str] | None = None, keyword_exprs: list[str] | None = None, parameter_expr: str | None = None, owners: list[str] | None = None, regex: str | None = None) list[ResolvedSpec]#

Find test case generators in scan_paths and add them to this workspace

select_from_specs(resolved: list[ResolvedSpec], prefixes: list[str] | None = None, keyword_exprs: list[str] | None = None, parameter_expr: str | None = None, owners: list[str] | None = None, regex: str | None = None) list[ResolvedSpec]#

Find test case generators in scan_paths and add them to this workspace

create_selection(tag: str | None, scanpaths: dict[str, list[str]], on_options: list[str] | None = None, keyword_exprs: list[str] | None = None, parameter_expr: str | None = None, owners: list[str] | None = None, regex: str | None = None) list[ResolvedSpec]#

Find test case generators in scan_paths and add them to this workspace

apply_selection_rules(specs: list[ResolvedSpec], keyword_exprs: list[str] | None = None, parameter_expr: str | None = None, owners: list[str] | None = None, regex: str | None = None, ids: list[str] | None = None) None#
load_testcases(ids: list[str] | None = None) list[TestCase]#

Load cached test cases. Dependency resolution is performed.

select_from_view(path: Path) list[ResolvedSpec]#
remove_tag(tag: str) bool#
is_tag(tag: str) bool#
generate_testspecs(generators: list[AbstractTestGenerator], on_options: list[str] | None = None) list[ResolvedSpec]#

Generate resolved test specs

Parameters:

on_options – Used to filter tests by option. In the typical case, options are added to on_options by passing them on the command line, e.g., -o dbg would add dbg to on_options. Tests can define filtering criteria based on what options are on.

Returns:

Resolved specs

construct_testcases(specs: list[ResolvedSpec], session: Path) list[TestCase]#
get_selection(tag: str | None) list[ResolvedSpec]#
gc(dryrun: bool = False) None#

Keep only the latet results

find(*, case: str | None = None, spec: str | None = None) Any#

Locate something in the workspace

find_testcase(root: str) TestCase#
find_testspec(root: str) ResolvedSpec#
find_specids(ids: list[str]) list[str | None]#
testcase_done_callback(event: EventTypes, *args: Any) None#
exception WorkspaceExistsError#

Bases: Exception

exception NotAWorkspaceError#

Bases: Exception

exception SpecNotFoundError#

Bases: Exception