Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/mozharness/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 944 B image not shown  

Quelle  test_base_log.py   Sprache: Python

 
import os
import shutil
import unittest

import mozharness.base.log as log
import mozunit

tmp_dir = "test_log_dir"
log_name = "test"


def clean_log_dir():
    if os.path.exists(tmp_dir):
        shutil.rmtree(tmp_dir)


def get_log_file_path(level=None):
    if level:
        return os.path.join(tmp_dir, "%s_%s.log" % (log_name, level))
    return os.path.join(tmp_dir, "%s.log" % log_name)


class TestLog(unittest.TestCase):
    def setUp(self):
        clean_log_dir()

    def tearDown(self):
        clean_log_dir()

    def test_log_dir(self):
        fh = open(tmp_dir, "w")
        fh.write("foo")
        fh.close()
        l = log.SimpleFileLogger(
            log_dir=tmp_dir, log_name=log_name, log_to_console=False
        )
        self.assertTrue(os.path.exists(tmp_dir))
        l.log_message("blah")
        self.assertTrue(os.path.exists(get_log_file_path()))
        del l


if __name__ == "__main__":
    mozunit.main()

98%


¤ Dauer der Verarbeitung: 0.9 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.