Skip to content

Commit

Permalink
chore(test): Add test for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tcjennings committed Dec 16, 2024
1 parent 5b10c89 commit db800b8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_cliScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
import os
import tempfile
import unittest
import unittest.mock

import click
import lsst.utils.tests
from lsst.ctrl.mpexec.cli import opt, script
from lsst.ctrl.mpexec.cli.cmd.commands import coverage_context
from lsst.ctrl.mpexec.cli.pipetask import cli as pipetaskCli
from lsst.ctrl.mpexec.showInfo import ShowInfo
from lsst.daf.butler.cli.utils import LogCliRunner, clickResultMsg
Expand Down Expand Up @@ -203,6 +205,17 @@ def cli(**kwargs):
self.assertNotEqual(result.exit_code, 0)


class CoverageTestCase(unittest.TestCase):
"""Test coverage context manager."""

@unittest.mock.patch.dict("sys.modules", coverage=unittest.mock.MagicMock())
def testWithCoverage(self):
"""Test that the coverage context manager runs when invoked."""

with coverage_context({"coverage": True}):
self.assertTrue(True)


if __name__ == "__main__":
lsst.utils.tests.init()
unittest.main()

0 comments on commit db800b8

Please sign in to comment.