Running some ATSes

These diagram show the working of code dated Nov 2018. They are made to find out how to gate/puts can use the Config (also see: Put/gate & pathways.core.config.Config). And to document the working.

Running pw

One can run one-or-more ATSfiles with one-or-more ATStests with pw. This ultimately run run_with_fixtures(); which is shown below.

@startUML
!include shared.ipuml

hide footbox
title pathways.__main~__.pw

control pw
control run_ATS

[-> pw 					: pw(args)

create probe
pw -> probe				: pathways.runners.probes.CmdlineProbe()

create parser
pw -> parser				: ArgumentParser(); ...

create config
pw -> config				: pathways.core.config.Config()
pw -> config				: argparse(app_parser=parser)
pw -> probe				: .cfg =config

loop ATSfile in config['ATSfiles']

   pw -> config				: read_for(ATSfile)
   pw -> probe				: update_loglevel()

   pw -> pw				: pw_path(config)

   create ATS <<file>> #lightgreen
   pw -> ATS 				: PluginManager().load()

   pw <-o ATS				: ~~list of ATStests~~ = discover(ATS.__dict~__)
   loop ats in ATS
      run_ATS(pw)
   end
end

destroy probe
[<<-- pw

@endUML

See also

Source

  • pathways.__main__.pw()

  • pathways.runners.run.run_ATS()

  • pathways.runners.run.discover()

Autorun

Alternatively, most ATS(files) can also be autorun –using trailer as shown. Although the sequence is a bit different, it will result in running run_with_fixtures().

if __name__ == "__main__":
    exit(pathways.autorun())

@startUML
!include shared.ipuml

hide footbox
title pathways.runners.run.autorun

participant ATSfile <<file>> #lightgreen
control autorun
control run_ATS

[-> ATSfile
ATSfile -> autorun 			: autorun()

create probe
autorun -> probe			: pathways.runners.probes.CmdlineProbe()

create config
autorun -> config			: pathways.core.config.Config(argparse=True)
autorun -> probe			: .cfg =config

autorun -> autorun			:  caller_frame = inspect.stack... ;

autorun -> ATSfile			:  ATSfile =\ninspect.getframeinfo(caller_frame).\nfilename

autorun -> config			: read_for(ATSfile)
autorun -> probe			: update_loglevel()

autorun <-o ATSfile			: atses=\ndiscover(caller_frame.globals)
loop ats in atses
   run_ATS(autorun)
end

autorun ->probe				: trace.critical(“ATS result ....”)
note right				: *critical*, so it is always printed

destroy probe
[<<-- autorun

@endUML

See also

Source

  • pathways.runners.run.autorun()

  • pathways.runners.run.run_ATS()

Running with Fixtures

When running an ATS(test), it @Setup, @Check and @Teardown fixtures are run before and after the ATS. And each Fixture can have this set of fixtures itself. The generalised in annex, and fixtures.

Notes

  • The call to pathways.runners.run._load_gate() returns a Gate (pathways.puts.put.Put instance), with is not used yet!

  • Probably, the Put class should be renamed to Gate.

  • pathways.core.annex.GenericFixture.run_with_fixtures() and pathways.core.annex.ATS_Infix.run_with_fixtures() are similar, but not the same. The later is a wrapper around the ATS and will run self._ats. The generic supports multi-phases (setup, check, teardown) and calls run_phase()