Browse Source

added flush() to gooey progress

master
Holger Frey 5 years ago
parent
commit
03ded27b0f
  1. 3
      sartorius_logger/__init__.py
  2. 2
      tests/test_sartorius_logger.py

3
sartorius_logger/__init__.py

@ -8,6 +8,7 @@ __version__ = "0.0.1"
import pandas import pandas
import sartoriusb import sartoriusb
import time import time
import sys
from collections import namedtuple from collections import namedtuple
from datetime import datetime from datetime import datetime
@ -108,7 +109,9 @@ def gooey_progress_factory(settings):
for i in iterator: for i in iterator:
print(f"measurement {i} of {total}") print(f"measurement {i} of {total}")
yield i yield i
sys.stdout.flush()
print(f"measurement {total} of {total}") print(f"measurement {total} of {total}")
sys.stdout.flush()
return gui_progress return gui_progress

2
tests/test_sartorius_logger.py

@ -12,7 +12,7 @@ def settings_fixture():
interval = ParsedDuration(10, "s", 10) interval = ParsedDuration(10, "s", 10)
directory = Path("/something/made/up") directory = Path("/something/made/up")
yield Settings(duration, interval, directory, "usb") yield Settings(duration, interval, directory, "usb", 31)
@pytest.fixture() @pytest.fixture()

Loading…
Cancel
Save