From a5ec11e4eee83a90e9a19982b60713bcedc54b18 Mon Sep 17 00:00:00 2001 From: Robert Meyer Date: Tue, 27 Feb 2018 20:08:02 +0100 Subject: [PATCH] New utils tests --- integration_tests/utils_test.py | 10 ++++++++++ tests/utils_test.py | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/utils_test.py diff --git a/integration_tests/utils_test.py b/integration_tests/utils_test.py index 3a8607b..16d16b4 100644 --- a/integration_tests/utils_test.py +++ b/integration_tests/utils_test.py @@ -1,4 +1,7 @@ import os +import logging + +import pandas as pd from integration_tests.bchain.getdata_test import temp_dir @@ -21,3 +24,10 @@ def test_clean_up(temp_dir): assert filenames[1].endswith('test_4.txt') +def test_logging_config(temp_dir): + assert len(os.listdir(temp_dir)) == 0 + + tfut.configure_logging(temp_dir, pd.datetime.utcnow()) + logging.getLogger().info('foobar') + + assert len(os.listdir(temp_dir)) == 1 diff --git a/tests/utils_test.py b/tests/utils_test.py new file mode 100644 index 0000000..0b9b956 --- /dev/null +++ b/tests/utils_test.py @@ -0,0 +1,8 @@ +from trufflepig.utils import progressbar + + +def test_progressbar(): + result = [] + for irun in range(100): + result.append(progressbar(irun, 100, percentage_step=1)) + assert all(result)