llama.test.classes module¶
Classes used in unit tests for LLAMA.
-
class
llama.test.classes.
AbstractFileGenerationChecker
¶ Bases:
llama.test.classes.AbstractFileGenerationComparator
Just like
AbstractFileGenerationComparator
, but does not compare file contents of outputs to a nominal value; instead, just checks whether the expected output files exist. Use this for files that do not depend deterministically on their inputs (and cannot therefore be compared with a simple diff to expected outputs).-
compare
()¶ Check whether running
execute
in the testeventdir
has produced all of the expected output files. Does not check contents. Use this for files whose contents do not deterministically depend on input files.- Returns
events_equal –
True
if the output is exactly as expected.False
in any other case.- Return type
bool
-
-
class
llama.test.classes.
AbstractFileGenerationComparator
¶ Bases:
abc.ABC
A class for running a test that produces some sort of expected output files for a given event and testing whether those output files are as expected by comparing them to reference files that are assumed correct. This class should be used to implement unit tests for the actual file generation steps of each step in the pipeline (including external triggering).
-
abstract property
EVENTID
¶ The
eventid
(i.e. the directory name) of the scenario that is being tested. Must correspond to anEvent
inTEST_RUN_INPUTS
(i.e.EVENTID
must be a directory inrun.rundir
for somerun
inTEST_RUN_INPUTS
).
-
INPUT_RUN
= Run(rundir="/root/.local/share/llama/inputs/tests/event_files", pipeline="Pipeline(<['Advok', 'CoincScatterI3LvcPdf', 'CoincScatterI3LvcPng', 'CoincScatterZtfI3LvcPdf', 'CoincScatterZtfI3LvcPng', 'CoincScatterZtfLVCPdf', 'CoincScatterZtfLVCPng', 'CoincSignificanceI3Lvc', 'CoincSignificanceSubthresholdI3Lvc', 'CoincSummaryI3LvcPdf', 'CoincSummaryI3LvcTex', 'FermiGRBsJSON', 'IceCubeNeutrinoList', 'IceCubeNeutrinoListCoincTxt', 'IceCubeNeutrinoListTex', 'IceCubeNeutrinoListTxt', 'LVAlertAdvok', 'LVAlertJSON', 'LVCGraceDbEventData', 'LvcDistancesJson', 'LvcGcnXml', 'LvcRetractionXml', 'LvcSkymapFits', 'LvcSkymapHdf5', 'PAstro', 'RctSlkI3CoincSummaryI3LvcPdf', 'RctSlkLmaCoincScatterI3LvcPdf', 'RctSlkLmaCoincScatterI3LvcPng', 'RctSlkLmaCoincScatterZtfI3LvcPdf', 'RctSlkLmaCoincScatterZtfI3LvcPng', 'RctSlkLmaCoincScatterZtfLVCPdf', 'RctSlkLmaCoincScatterZtfLVCPng', 'RctSlkLmaCoincSignificanceI3Lvc', 'RctSlkLmaCoincSignificanceSubthresholdI3Lvc', 'RctSlkLmaCoincSummaryI3LvcPdf', 'RctSlkLmaLVAlertJSON', 'RctSlkLmaLVCGraceDbEventData', 'RctSlkLmaLvcDistancesJson', 'RctSlkLmaLvcGcnXml', 'RctSlkLmaLvcRetractionXml', 'RctSlkLmaSkymapInfo', 'SkymapInfo', 'ZtfTriggerList']>)")¶
-
abstract property
STARTING_MANIFEST
¶ A tuple of specific
FileHandler
classes whose files should be copied from the input directory inTEST_RUN_INPUTS
to the temporary output test directory. This will set the starting state for the test.
-
compare
()¶ Compare the outputs of
execute
in the testeventdir
to the expected values in the inputEvent
fromTEST_RUN_INPUTS
. Checks whether the file contents are strictly equal.- Returns
events_equal –
True
if the output is exactly as expected.False
in any other case.- Return type
bool
-
property
event
¶ An
Event
instance corresponding to the output files of this test. Use this instance to get e.g. file locations if necessary.
-
abstract
execute
()¶ Run the actual test (no need to compare outputs; this will be done in
compare
).
-
property
inputevent
¶ An
Event
instance corresponding to the input files of this test.
-
abstract property
pipeline
¶ A
Pipeline
instance defining the output files generated by this test. These are the output files that will be compared byAbstractFileGenerationComparator.compare
to make sure that all outputs are as expected (and, as a sanity check, that no inputs have been mutated).
-
provision
()¶ Link or copy input files from
STARTING_MANIFEST
intoevent.eventdir
so that they are available forexecute
. The test directory is presumed to exist.
-
property
run
¶ A temporary
Run
instance for tests (probably using apytest
fixture) where the test outputs for this test’sEVENTID
will reside. Feel free to override this with a custom directory.
-
test
()¶ Run this test with
execute
and then check whether outputs are as expected withcompare
.
-
abstract property
-
class
llama.test.classes.
MS181101abMixin
¶ Bases:
object
Tests on an ER14-era test event from the EM Follow-up userguide.
-
EVENTID
= 'MS181101ab-2-Initial'¶
-
-
class
llama.test.classes.
S190412mMixin
¶ Bases:
object
Tests on S190412m, a manually-triggered BBH event in early O3.
-
EVENTID
= 'S190412m'¶
-