From 03ded27b0feed49b112db0ad168fd5a542825dcc Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 11 Nov 2019 14:20:34 +0100 Subject: [PATCH] added flush() to gooey progress --- sartorius_logger/__init__.py | 3 +++ tests/test_sartorius_logger.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sartorius_logger/__init__.py b/sartorius_logger/__init__.py index ed7f8cf..1d40f10 100644 --- a/sartorius_logger/__init__.py +++ b/sartorius_logger/__init__.py @@ -8,6 +8,7 @@ __version__ = "0.0.1" import pandas import sartoriusb import time +import sys from collections import namedtuple from datetime import datetime @@ -108,7 +109,9 @@ def gooey_progress_factory(settings): for i in iterator: print(f"measurement {i} of {total}") yield i + sys.stdout.flush() print(f"measurement {total} of {total}") + sys.stdout.flush() return gui_progress diff --git a/tests/test_sartorius_logger.py b/tests/test_sartorius_logger.py index efe8fb1..bdeef75 100644 --- a/tests/test_sartorius_logger.py +++ b/tests/test_sartorius_logger.py @@ -12,7 +12,7 @@ def settings_fixture(): interval = ParsedDuration(10, "s", 10) directory = Path("/something/made/up") - yield Settings(duration, interval, directory, "usb") + yield Settings(duration, interval, directory, "usb", 31) @pytest.fixture()