Coverage for tests/test_cmdLineFwk.py : 20%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of ctrl_mpexec.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
22"""Simple unit test for cmdLineFwk module.
23"""
25import click
26from types import SimpleNamespace
27import contextlib
28import copy
29from dataclasses import dataclass
30import logging
31import os
32import pickle
33import shutil
34import tempfile
35from typing import NamedTuple
36import unittest
38from lsst.ctrl.mpexec.cmdLineFwk import CmdLineFwk
39from lsst.ctrl.mpexec.cli.opt import run_options
40from lsst.ctrl.mpexec.cli.utils import (
41 _ACTION_ADD_TASK,
42 _ACTION_CONFIG,
43 _ACTION_CONFIG_FILE,
44 _ACTION_ADD_INSTRUMENT,
45 PipetaskCommand,
46)
47from lsst.daf.butler import Config, Quantum, Registry
48from lsst.daf.butler.registry import RegistryConfig
49from lsst.obs.base import Instrument
50import lsst.pex.config as pexConfig
51from lsst.pipe.base import (Pipeline, PipelineTask, PipelineTaskConfig,
52 QuantumGraph, TaskDef, TaskFactory,
53 PipelineTaskConnections)
54import lsst.pipe.base.connectionTypes as cT
55import lsst.utils.tests
56from lsst.pipe.base.tests.simpleQGraph import (AddTaskFactoryMock, makeSimpleQGraph)
57from lsst.utils.tests import temporaryDirectory
60logging.basicConfig(level=logging.INFO)
62# Have to monkey-patch Instrument.fromName() to not retrieve non-existing
63# instrument from registry, these tests can run fine without actual instrument
64# and implementing full mock for Instrument is too complicated.
65Instrument.fromName = lambda name, reg: None 65 ↛ exitline 65 didn't run the lambda on line 65
68@contextlib.contextmanager
69def makeTmpFile(contents=None, suffix=None):
70 """Context manager for generating temporary file name.
72 Temporary file is deleted on exiting context.
74 Parameters
75 ----------
76 contents : `bytes`
77 Data to write into a file.
78 """
79 fd, tmpname = tempfile.mkstemp(suffix=suffix)
80 if contents:
81 os.write(fd, contents)
82 os.close(fd)
83 yield tmpname
84 with contextlib.suppress(OSError):
85 os.remove(tmpname)
88@contextlib.contextmanager
89def makeSQLiteRegistry(create=True):
90 """Context manager to create new empty registry database.
92 Yields
93 ------
94 config : `RegistryConfig`
95 Registry configuration for initialized registry database.
96 """
97 with temporaryDirectory() as tmpdir:
98 uri = f"sqlite:///{tmpdir}/gen3.sqlite"
99 config = RegistryConfig()
100 config["db"] = uri
101 if create:
102 Registry.createFromConfig(config)
103 yield config
106class SimpleConnections(PipelineTaskConnections, dimensions=(),
107 defaultTemplates={"template": "simple"}):
108 schema = cT.InitInput(doc="Schema",
109 name="{template}schema",
110 storageClass="SourceCatalog")
113class SimpleConfig(PipelineTaskConfig, pipelineConnections=SimpleConnections):
114 field = pexConfig.Field(dtype=str, doc="arbitrary string")
116 def setDefaults(self):
117 PipelineTaskConfig.setDefaults(self)
120class TaskOne(PipelineTask):
121 ConfigClass = SimpleConfig
122 _DefaultName = "taskOne"
125class TaskTwo(PipelineTask):
126 ConfigClass = SimpleConfig
127 _DefaultName = "taskTwo"
130class TaskFactoryMock(TaskFactory):
131 def loadTaskClass(self, taskName):
132 if taskName == "TaskOne":
133 return TaskOne, "TaskOne"
134 elif taskName == "TaskTwo":
135 return TaskTwo, "TaskTwo"
137 def makeTask(self, taskClass, name, config, overrides, butler):
138 if config is None:
139 config = taskClass.ConfigClass()
140 if overrides:
141 overrides.applyTo(config)
142 return taskClass(config=config, butler=butler, name=name)
145def _makeArgs(registryConfig=None, **kwargs):
146 """Return parsed command line arguments.
148 By default butler_config is set to `Config` populated with some defaults,
149 it can be overridden completely by keyword argument.
151 Parameters
152 ----------
153 cmd : `str`, optional
154 Produce arguments for this pipetask command.
155 registryConfig : `RegistryConfig`, optional
156 Override for registry configuration.
157 **kwargs
158 Overrides for other arguments.
159 """
160 # Use a mock to get the default value of arguments to 'run'.
162 mock = unittest.mock.Mock()
164 @click.command(cls=PipetaskCommand)
165 @run_options()
166 def fake_run(ctx, **kwargs):
167 """Fake "pipetask run" command for gathering input arguments.
169 The arguments & options should always match the arguments & options in
170 the "real" command function `lsst.ctrl.mpexec.cli.cmd.run`.
171 """
172 mock(**kwargs)
174 runner = click.testing.CliRunner()
175 result = runner.invoke(fake_run)
176 if result.exit_code != 0:
177 raise RuntimeError(f"Failure getting default args from 'fake_run': {result}")
178 mock.assert_called_once()
179 args = mock.call_args[1]
180 args["enableLsstDebug"] = args.pop("debug")
181 if "pipeline_actions" not in args:
182 args["pipeline_actions"] = []
183 args = SimpleNamespace(**args)
185 # override butler_config with our defaults
186 args.butler_config = Config()
187 if registryConfig:
188 args.butler_config["registry"] = registryConfig
189 # The default datastore has a relocatable root, so we need to specify
190 # some root here for it to use
191 args.butler_config.configFile = "."
192 # override arguments from keyword parameters
193 for key, value in kwargs.items():
194 setattr(args, key, value)
195 return args
198class FakeTaskDef(NamedTuple):
199 name: str
202@dataclass(frozen=True)
203class FakeDSRef:
204 datasetType: str
205 dataId: tuple
208def _makeQGraph():
209 """Make a trivial QuantumGraph with one quantum.
211 The only thing that we need to do with this quantum graph is to pickle
212 it, the quanta in this graph are not usable for anything else.
214 Returns
215 -------
216 qgraph : `~lsst.pipe.base.QuantumGraph`
217 """
219 # The task name in TaskDef needs to be a real importable name, use one that is sure to exist
220 taskDef = TaskDef(taskName="lsst.pipe.base.Struct", config=SimpleConfig())
221 quanta = [Quantum(taskName="lsst.pipe.base.Struct",
222 inputs={FakeTaskDef("A"): FakeDSRef("A", (1, 2))})] # type: ignore
223 qgraph = QuantumGraph({taskDef: set(quanta)})
224 return qgraph
227class CmdLineFwkTestCase(unittest.TestCase):
228 """A test case for CmdLineFwk
229 """
231 def testMakePipeline(self):
232 """Tests for CmdLineFwk.makePipeline method
233 """
234 fwk = CmdLineFwk()
236 # make empty pipeline
237 args = _makeArgs()
238 pipeline = fwk.makePipeline(args)
239 self.assertIsInstance(pipeline, Pipeline)
240 self.assertEqual(len(pipeline), 0)
242 # few tests with serialization
243 with makeTmpFile() as tmpname:
244 # make empty pipeline and store it in a file
245 args = _makeArgs(save_pipeline=tmpname)
246 pipeline = fwk.makePipeline(args)
247 self.assertIsInstance(pipeline, Pipeline)
249 # read pipeline from a file
250 args = _makeArgs(pipeline=tmpname)
251 pipeline = fwk.makePipeline(args)
252 self.assertIsInstance(pipeline, Pipeline)
253 self.assertEqual(len(pipeline), 0)
255 # single task pipeline
256 actions = [
257 _ACTION_ADD_TASK("TaskOne:task1")
258 ]
259 args = _makeArgs(pipeline_actions=actions)
260 pipeline = fwk.makePipeline(args)
261 self.assertIsInstance(pipeline, Pipeline)
262 self.assertEqual(len(pipeline), 1)
264 # many task pipeline
265 actions = [
266 _ACTION_ADD_TASK("TaskOne:task1a"),
267 _ACTION_ADD_TASK("TaskTwo:task2"),
268 _ACTION_ADD_TASK("TaskOne:task1b")
269 ]
270 args = _makeArgs(pipeline_actions=actions)
271 pipeline = fwk.makePipeline(args)
272 self.assertIsInstance(pipeline, Pipeline)
273 self.assertEqual(len(pipeline), 3)
275 # single task pipeline with config overrides, cannot use TaskOne, need
276 # something that can be imported with `doImport()`
277 actions = [
278 _ACTION_ADD_TASK("lsst.pipe.base.tests.simpleQGraph.AddTask:task"),
279 _ACTION_CONFIG("task:addend=100")
280 ]
281 args = _makeArgs(pipeline_actions=actions)
282 pipeline = fwk.makePipeline(args)
283 taskDefs = list(pipeline.toExpandedPipeline())
284 self.assertEqual(len(taskDefs), 1)
285 self.assertEqual(taskDefs[0].config.addend, 100)
287 overrides = b"config.addend = 1000\n"
288 with makeTmpFile(overrides) as tmpname:
289 actions = [
290 _ACTION_ADD_TASK("lsst.pipe.base.tests.simpleQGraph.AddTask:task"),
291 _ACTION_CONFIG_FILE("task:" + tmpname)
292 ]
293 args = _makeArgs(pipeline_actions=actions)
294 pipeline = fwk.makePipeline(args)
295 taskDefs = list(pipeline.toExpandedPipeline())
296 self.assertEqual(len(taskDefs), 1)
297 self.assertEqual(taskDefs[0].config.addend, 1000)
299 # Check --instrument option, for now it only checks that it does not crash
300 actions = [
301 _ACTION_ADD_TASK("lsst.pipe.base.tests.simpleQGraph.AddTask:task"),
302 _ACTION_ADD_INSTRUMENT("Instrument")
303 ]
304 args = _makeArgs(pipeline_actions=actions)
305 pipeline = fwk.makePipeline(args)
307 def testMakeGraphFromSave(self):
308 """Tests for CmdLineFwk.makeGraph method.
310 Only most trivial case is tested that does not do actual graph
311 building.
312 """
313 fwk = CmdLineFwk()
315 with makeTmpFile(suffix=".qgraph") as tmpname, makeSQLiteRegistry() as registryConfig:
317 # make non-empty graph and store it in a file
318 qgraph = _makeQGraph()
319 with open(tmpname, "wb") as saveFile:
320 qgraph.save(saveFile)
321 args = _makeArgs(qgraph=tmpname, registryConfig=registryConfig)
322 qgraph = fwk.makeGraph(None, args)
323 self.assertIsInstance(qgraph, QuantumGraph)
324 self.assertEqual(len(qgraph), 1)
326 # will fail if graph id does not match
327 args = _makeArgs(
328 qgraph=tmpname,
329 qgraph_id="R2-D2 is that you?",
330 registryConfig=registryConfig
331 )
332 with self.assertRaisesRegex(ValueError, "graphID does not match"):
333 fwk.makeGraph(None, args)
335 # save with wrong object type
336 with open(tmpname, "wb") as saveFile:
337 pickle.dump({}, saveFile)
338 args = _makeArgs(qgraph=tmpname, registryConfig=registryConfig)
339 with self.assertRaises(ValueError):
340 fwk.makeGraph(None, args)
342 # reading empty graph from pickle should work but makeGraph()
343 # will return None and make a warning
344 qgraph = QuantumGraph(dict())
345 with open(tmpname, "wb") as saveFile:
346 qgraph.save(saveFile)
347 args = _makeArgs(qgraph=tmpname, registryConfig=registryConfig)
348 with self.assertWarnsRegex(UserWarning, "QuantumGraph is empty"):
349 # this also tests that warning is generated for empty graph
350 qgraph = fwk.makeGraph(None, args)
351 self.assertIs(qgraph, None)
353 def testShowPipeline(self):
354 """Test for --show options for pipeline.
355 """
356 fwk = CmdLineFwk()
358 actions = [
359 _ACTION_ADD_TASK("lsst.pipe.base.tests.simpleQGraph.AddTask:task"),
360 _ACTION_CONFIG("task:addend=100")
361 ]
362 args = _makeArgs(pipeline_actions=actions)
363 pipeline = fwk.makePipeline(args)
365 args.show = ["pipeline"]
366 fwk.showInfo(args, pipeline)
367 args.show = ["config"]
368 fwk.showInfo(args, pipeline)
369 args.show = ["history=task::addend"]
370 fwk.showInfo(args, pipeline)
371 args.show = ["tasks"]
372 fwk.showInfo(args, pipeline)
375class CmdLineFwkTestCaseWithButler(unittest.TestCase):
376 """A test case for CmdLineFwk
377 """
379 def setUp(self):
380 super().setUpClass()
381 self.root = tempfile.mkdtemp()
383 def tearDown(self):
384 shutil.rmtree(self.root, ignore_errors=True)
385 super().tearDownClass()
387 def testSimpleQGraph(self):
388 """Test successfull execution of trivial quantum graph.
389 """
391 nQuanta = 5
392 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root)
394 self.assertEqual(len(qgraph.taskGraph), 5)
395 self.assertEqual(len(qgraph), nQuanta)
397 args = _makeArgs()
398 fwk = CmdLineFwk()
399 taskFactory = AddTaskFactoryMock()
401 # run whole thing
402 fwk.runPipeline(qgraph, taskFactory, args, butler=butler)
403 self.assertEqual(taskFactory.countExec, nQuanta)
405 def testSimpleQGraphSkipExisting(self):
406 """Test continuing execution of trivial quantum graph with --skip-existing.
407 """
409 nQuanta = 5
410 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root)
412 self.assertEqual(len(qgraph.taskGraph), 5)
413 self.assertEqual(len(qgraph), nQuanta)
415 args = _makeArgs()
416 fwk = CmdLineFwk()
417 taskFactory = AddTaskFactoryMock(stopAt=3)
419 # run first three quanta
420 with self.assertRaises(RuntimeError):
421 fwk.runPipeline(qgraph, taskFactory, args, butler=butler)
422 self.assertEqual(taskFactory.countExec, 3)
424 # run remaining ones
425 taskFactory.stopAt = -1
426 args.skip_existing = True
427 args.extend_run = True
428 args.no_versions = True
429 fwk.runPipeline(qgraph, taskFactory, args, butler=butler)
430 self.assertEqual(taskFactory.countExec, nQuanta)
432 def testSimpleQGraphPartialOutputsFail(self):
433 """Test continuing execution of trivial quantum graph with partial
434 outputs.
435 """
437 nQuanta = 5
438 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root)
440 # should have one task and number of quanta
441 self.assertEqual(len(qgraph), nQuanta)
443 args = _makeArgs()
444 fwk = CmdLineFwk()
445 taskFactory = AddTaskFactoryMock(stopAt=3)
447 # run first three quanta
448 with self.assertRaises(RuntimeError):
449 fwk.runPipeline(qgraph, taskFactory, args, butler=butler)
450 self.assertEqual(taskFactory.countExec, 3)
452 # drop one of the two outputs from one task
453 ref = butler._findDatasetRef("add2_dataset2", instrument="INSTR", detector=0)
454 self.assertIsNotNone(ref)
455 butler.pruneDatasets([ref], disassociate=True, unstore=True, purge=True)
457 taskFactory.stopAt = -1
458 args.skip_existing = True
459 args.extend_run = True
460 args.no_versions = True
461 excRe = "Registry inconsistency while checking for existing outputs.*"
462 with self.assertRaisesRegex(RuntimeError, excRe):
463 fwk.runPipeline(qgraph, taskFactory, args, butler=butler)
465 def testSimpleQGraphClobberPartialOutputs(self):
466 """Test continuing execution of trivial quantum graph with
467 --clobber-partial-outputs.
468 """
470 nQuanta = 5
471 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root)
473 # should have one task and number of quanta
474 self.assertEqual(len(qgraph), nQuanta)
476 args = _makeArgs()
477 fwk = CmdLineFwk()
478 taskFactory = AddTaskFactoryMock(stopAt=3)
480 # run first three quanta
481 with self.assertRaises(RuntimeError):
482 fwk.runPipeline(qgraph, taskFactory, args, butler=butler)
483 self.assertEqual(taskFactory.countExec, 3)
485 # drop one of the two outputs from one task
486 ref = butler._findDatasetRef("add2_dataset2", instrument="INSTR", detector=0)
487 self.assertIsNotNone(ref)
488 butler.pruneDatasets([ref], disassociate=True, unstore=True, purge=True)
490 taskFactory.stopAt = -1
491 args.skip_existing = True
492 args.extend_run = True
493 args.clobber_partial_outputs = True
494 args.no_versions = True
495 fwk.runPipeline(qgraph, taskFactory, args, butler=butler)
496 # number of executed quanta is incremented
497 self.assertEqual(taskFactory.countExec, nQuanta + 1)
499 def testSimpleQGraphReplaceRun(self):
500 """Test repeated execution of trivial quantum graph with
501 --replace-run.
502 """
504 # need non-memory registry in this case
505 nQuanta = 5
506 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root, inMemory=False)
508 # should have one task and number of quanta
509 self.assertEqual(len(qgraph), nQuanta)
511 fwk = CmdLineFwk()
512 taskFactory = AddTaskFactoryMock()
514 # run whole thing
515 args = _makeArgs(
516 butler_config=self.root,
517 input="test",
518 output="output",
519 output_run="output/run1")
520 # deep copy is needed because quanta are updated in place
521 fwk.runPipeline(copy.deepcopy(qgraph), taskFactory, args)
522 self.assertEqual(taskFactory.countExec, nQuanta)
524 # need to refresh collections explicitly (or make new butler/registry)
525 butler.registry.refresh()
526 collections = set(butler.registry.queryCollections(...))
527 self.assertEqual(collections, {"test", "output", "output/run1"})
529 # number of datasets written by pipeline:
530 # - nQuanta of init_outputs
531 # - nQuanta of configs
532 # - packages (single dataset)
533 # - nQuanta * two output datasets
534 # - nQuanta of metadata
535 n_outputs = nQuanta * 5 + 1
536 refs = butler.registry.queryDatasets(..., collections="output/run1")
537 self.assertEqual(len(list(refs)), n_outputs)
539 # re-run with --replace-run (--inputs is ignored, as long as it hasn't
540 # changed)
541 args.replace_run = True
542 args.output_run = "output/run2"
543 fwk.runPipeline(copy.deepcopy(qgraph), taskFactory, args)
545 butler.registry.refresh()
546 collections = set(butler.registry.queryCollections(...))
547 self.assertEqual(collections, {"test", "output", "output/run1", "output/run2"})
549 # new output collection
550 refs = butler.registry.queryDatasets(..., collections="output/run2")
551 self.assertEqual(len(list(refs)), n_outputs)
553 # old output collection is still there
554 refs = butler.registry.queryDatasets(..., collections="output/run1")
555 self.assertEqual(len(list(refs)), n_outputs)
557 # re-run with --replace-run and --prune-replaced=unstore
558 args.replace_run = True
559 args.prune_replaced = "unstore"
560 args.output_run = "output/run3"
561 fwk.runPipeline(copy.deepcopy(qgraph), taskFactory, args)
563 butler.registry.refresh()
564 collections = set(butler.registry.queryCollections(...))
565 self.assertEqual(collections, {"test", "output", "output/run1", "output/run2", "output/run3"})
567 # new output collection
568 refs = butler.registry.queryDatasets(..., collections="output/run3")
569 self.assertEqual(len(list(refs)), n_outputs)
571 # old output collection is still there, and it has all datasets but
572 # they are not in datastore
573 refs = butler.registry.queryDatasets(..., collections="output/run2")
574 refs = list(refs)
575 self.assertEqual(len(refs), n_outputs)
576 with self.assertRaises(FileNotFoundError):
577 butler.get(refs[0], collections="output/run2")
579 # re-run with --replace-run and --prune-replaced=purge
580 # This time also remove --input; passing the same inputs that we
581 # started with and not passing inputs at all should be equivalent.
582 args.input = None
583 args.replace_run = True
584 args.prune_replaced = "purge"
585 args.output_run = "output/run4"
586 fwk.runPipeline(copy.deepcopy(qgraph), taskFactory, args)
588 butler.registry.refresh()
589 collections = set(butler.registry.queryCollections(...))
590 # output/run3 should disappear now
591 self.assertEqual(collections, {"test", "output", "output/run1", "output/run2", "output/run4"})
593 # new output collection
594 refs = butler.registry.queryDatasets(..., collections="output/run4")
595 self.assertEqual(len(list(refs)), n_outputs)
597 # Trying to run again with inputs that aren't exactly what we started
598 # with is an error, and the kind that should not modify the data repo.
599 with self.assertRaises(ValueError):
600 args.input = ["test", "output/run2"]
601 args.prune_replaced = None
602 args.replace_run = True
603 args.output_run = "output/run5"
604 fwk.runPipeline(copy.deepcopy(qgraph), taskFactory, args)
605 butler.registry.refresh()
606 collections = set(butler.registry.queryCollections(...))
607 self.assertEqual(collections, {"test", "output", "output/run1", "output/run2", "output/run4"})
608 with self.assertRaises(ValueError):
609 args.input = ["output/run2", "test"]
610 args.prune_replaced = None
611 args.replace_run = True
612 args.output_run = "output/run6"
613 fwk.runPipeline(copy.deepcopy(qgraph), taskFactory, args)
614 butler.registry.refresh()
615 collections = set(butler.registry.queryCollections(...))
616 self.assertEqual(collections, {"test", "output", "output/run1", "output/run2", "output/run4"})
618 def testSubgraph(self):
619 """Test successfull execution of trivial quantum graph.
620 """
621 nQuanta = 5
622 nNodes = 2
623 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root)
625 # Select first two nodes for execution. This depends on node ordering
626 # which I assume is the same as execution order.
627 nodeIds = [node.nodeId.number for node in qgraph]
628 nodeIds = nodeIds[:nNodes]
630 self.assertEqual(len(qgraph.taskGraph), 5)
631 self.assertEqual(len(qgraph), nQuanta)
633 with makeTmpFile(suffix=".qgraph") as tmpname, makeSQLiteRegistry() as registryConfig:
634 with open(tmpname, "wb") as saveFile:
635 qgraph.save(saveFile)
637 args = _makeArgs(qgraph=tmpname, qgraph_node_id=nodeIds, registryConfig=registryConfig)
638 fwk = CmdLineFwk()
640 # load graph, should only read a subset
641 qgraph = fwk.makeGraph(pipeline=None, args=args)
642 self.assertEqual(len(qgraph), nNodes)
644 def testShowGraph(self):
645 """Test for --show options for quantum graph.
646 """
647 fwk = CmdLineFwk()
649 nQuanta = 2
650 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root)
652 args = _makeArgs(show=["graph"])
653 fwk.showInfo(args, pipeline=None, graph=qgraph)
655 def testShowGraphWorkflow(self):
656 fwk = CmdLineFwk()
658 nQuanta = 2
659 butler, qgraph = makeSimpleQGraph(nQuanta, root=self.root)
661 args = _makeArgs(show=["workflow"])
662 fwk.showInfo(args, pipeline=None, graph=qgraph)
664 # TODO: cannot test "uri" option presently, it instanciates
665 # butler from command line options and there is no way to pass butler
666 # mock to that code.
669class MyMemoryTestCase(lsst.utils.tests.MemoryTestCase):
670 pass
673def setup_module(module):
674 lsst.utils.tests.init()
677if __name__ == "__main__": 677 ↛ 678line 677 didn't jump to line 678, because the condition on line 677 was never true
678 lsst.utils.tests.init()
679 unittest.main()