Coverage for pesummary/tests/finish_test.py: 100.0%
24 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-12-09 22:34 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-12-09 22:34 +0000
1# Licensed under an MIT style license -- see LICENSE.md
3import shutil
4import os
5import pytest
7from .base import make_argparse
8from pesummary.core.finish import FinishingTouches
9import tempfile
11tmpdir = tempfile.TemporaryDirectory(prefix=".", dir=".").name
13__author__ = ["Charlie Hoy <charlie.hoy@ligo.org>"]
16class TestFinishingTouches(object):
17 """Class to test pesummary.core.finish.FinishingTouches
18 """
19 def setup_method(self):
20 """Setup the pesummary.core.finish.FinishingTouches class
21 """
22 if not os.path.isdir(tmpdir):
23 os.mkdir(tmpdir)
24 opts, inputs = make_argparse(outdir=tmpdir)
25 self.finish = FinishingTouches(inputs)
27 def teardown_method(self):
28 """Remove the any files generated
29 """
30 if os.path.isdir(tmpdir):
31 shutil.rmtree(tmpdir)
33 def test_default_message(self):
34 """Test the default email message
35 """
36 message = self.finish._email_message()
37 assert message is not None
39 def test_custom_message(self):
40 """Test a custom email message
41 """
42 custom_message = "This is a test message"
43 message = self.finish._email_message(message=custom_message)
44 assert message == custom_message