예제 #1
0
def test_multiprocessing():

    log_directory = Path("temp", application_name)

    balsa = Balsa(application_name,
                  __author__,
                  verbose=True,
                  log_directory=log_directory,
                  delete_existing_log_files=True)
    balsa.init_logger()

    log = get_logger(application_name)

    log.info("process started")

    balsa_config = balsa.config_as_dict()
    my_process = MyProcess(balsa_config)
    my_process.start()
    my_process.join()

    process_log_file_path = Path(log_directory, f"{application_name}_a.log")
    assert process_log_file_path.exists()
    log_text = process_log_file_path.read_text()
    # check everything except the timestamp and line number
    assert "test_balsa_multiprocess - a - test_multiprocessing.py -" in log_text
    assert "- run - INFO - hello from a" in log_text

    log.info("process finished")
예제 #2
0
def test_balsa_clone_parent():

    my_balsa = Balsa("test_balsa_clone_parent_a", "parent_a")
    my_balsa_config = my_balsa.config_as_dict()

    new_balsa = balsa_clone(my_balsa_config, "test_balsa_clone_parent_b", my_balsa)
    new_balsa.init_logger()
    new_balsa.log.error("no parent")

    my_balsa.remove()
    new_balsa.remove()
def test_multiprocessing():

    balsa = Balsa(application_name, author, verbose=True)
    balsa.init_logger()
    log = get_logger(application_name)
    log.info("process started")

    my_process = MyProcess(balsa.config_as_dict())
    my_process.start()
    my_process.join()

    log.info("process finished")