diff --git a/distributed/cli/tests/test_dask_scheduler.py b/distributed/cli/tests/test_dask_scheduler.py index a407a2b8fe1..f69ec48127b 100644 --- a/distributed/cli/tests/test_dask_scheduler.py +++ b/distributed/cli/tests/test_dask_scheduler.py @@ -236,11 +236,13 @@ def test_dashboard_port_zero(loop): with popen(["dask-scheduler", "--dashboard-address", ":0"]) as proc: count = 0 while count < 1: - line = proc.stderr.readline() - if b"dashboard" in line.lower(): + line = proc.stderr.readline().decode("utf8") + if "dashboard" in line.lower(): sleep(0.01) count += 1 - assert b":0" not in line + # Remove timestamp from logging line which may contain ":0" + line = " - ".join(line.split(" - ")[1:]) + assert ":0" not in line PRELOAD_TEXT = """ diff --git a/distributed/distributed.yaml b/distributed/distributed.yaml index c71845e3769..2c3ce96ba0a 100644 --- a/distributed/distributed.yaml +++ b/distributed/distributed.yaml @@ -182,7 +182,7 @@ distributed: max-error-length: 10000 # Maximum size traceback after error to return log-length: 10000 # default length of logs to keep in memory - log-format: '%(name)s - %(levelname)s - %(message)s' + log-format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' pdb-on-err: False # enter debug mode on scheduling error system-monitor: interval: 500ms diff --git a/distributed/tests/test_config.py b/distributed/tests/test_config.py index 200493a822c..4d8ca7afab9 100644 --- a/distributed/tests/test_config.py +++ b/distributed/tests/test_config.py @@ -91,10 +91,12 @@ def test_logging_default(): foreign_log = foreign_log.getvalue().splitlines() # distributed log is configured at INFO level by default - assert distributed_log == [ + expected_log_suffix = [ "distributed - INFO - 2: info", "distributed.foo.bar - INFO - 3: info", ] + for result, expected_suffix in zip(distributed_log, expected_log_suffix): + assert result.endswith(expected_suffix) # foreign logs should be unaffected by distributed's logging # configuration. They get the default ERROR level from logging. @@ -139,10 +141,13 @@ def test_logging_simple_under_distributed(): distributed_log = distributed_log.getvalue().splitlines() - assert distributed_log == [ + expected_log_suffix = [ "distributed.foo - INFO - 1: info", "distributed.foo.bar - ERROR - 3: error", - ], (dask.config.config, distributed_log) + ] + + for result, expected_suffix in zip(distributed_log, expected_log_suffix): + assert result.endswith(expected_suffix), (dask.config.config, distributed_log) """ subprocess.check_call([sys.executable, "-c", code]) @@ -174,10 +179,13 @@ def test_logging_simple(): distributed_log = distributed_log.getvalue().splitlines() - assert distributed_log == [ + expected_log_suffix = [ "distributed.foo - INFO - 1: info", "distributed.foo.bar - ERROR - 3: error", - ], (dask.config.config, distributed_log) + ] + + for result, expected_suffix in zip(distributed_log, expected_log_suffix): + assert result.endswith(expected_suffix), (dask.config.config, distributed_log) """ subprocess.check_call([sys.executable, "-c", code]) diff --git a/setup.cfg b/setup.cfg index 6016c5fb133..367862473cd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,6 +51,7 @@ filterwarnings = minversion = 4 markers = slow: marks tests as slow (deselect with '-m "not slow"') + asyncio: marks tests that test async functionality avoid_ci: marks tests as flaky on CI on all OSs ipython: marks tests as exercising IPython timeout_method = thread