diff --git a/pytest.ini b/pytest.ini index 1f7ce09fc..18a858942 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,7 @@ [pytest] testpaths = tiled/_tests +log_cli = 1 +log_cli_level = WARNING +log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s) +log_cli_date_format=%Y-%m-%d %H:%M:%S diff --git a/tiled/_tests/conftest.py b/tiled/_tests/conftest.py index 341368bc8..f9aa778d2 100644 --- a/tiled/_tests/conftest.py +++ b/tiled/_tests/conftest.py @@ -78,15 +78,18 @@ def tmpdir_module(request, tmpdir_factory): return tmpdir_factory.mktemp(request.module.__name__) -# Use this with pytest -s option. +# Use this with pytest --log-cli-level=25 option. if os.getenv("TILED_DEBUG_LEAKED_THREADS"): + import logging import threading import time def poll_enumerate(): + logger = logging.getLogger(__name__) + msg_level = int(logging.INFO + logging.WARNING) // 2 while True: time.sleep(1) - print("THREAD COUNT", len(threading.enumerate())) + logger.log(msg_level, "THREAD COUNT = %d", len(threading.enumerate())) thread = threading.Thread(target=poll_enumerate, daemon=True) thread.start() diff --git a/tiled/_tests/test_array.py b/tiled/_tests/test_array.py index 9f44f0da0..e2acd556b 100644 --- a/tiled/_tests/test_array.py +++ b/tiled/_tests/test_array.py @@ -108,8 +108,12 @@ def test_shape_with_zero(context): def test_nan_infinity_handler(tmpdir, context): client = from_context(context)["inf"] - print(f"Metadata: {client['example'].metadata}") - print(f"Data: {client['example'].read()}") + data = client["example"].read() + assert numpy.isnan(data).any() + assert numpy.isinf(data).any() + metadata = tuple(client["example"].metadata.values()) + assert numpy.isnan(metadata).any() + assert numpy.isinf(metadata).any() Path(tmpdir, "testjson").mkdir() client["example"].export(Path(tmpdir, "testjson", "test.json")) diff --git a/tiled/_tests/test_hdf5.py b/tiled/_tests/test_hdf5.py index d662c20ff..ff6c0f66c 100644 --- a/tiled/_tests/test_hdf5.py +++ b/tiled/_tests/test_hdf5.py @@ -32,7 +32,7 @@ def example_file_with_vlen_str_in_dataset(): # Need to do this to make a vlen str dataset dt = h5py.string_dtype(encoding="utf-8") dset = c.create_dataset("d", (100,), dtype=dt) - # print(dset.dtype) + assert dset.dtype == "object" dset[0] = b"test" return file diff --git a/tiled/adapters/tiff.py b/tiled/adapters/tiff.py index 2365fac6f..f78e8a2da 100644 --- a/tiled/adapters/tiff.py +++ b/tiled/adapters/tiff.py @@ -144,7 +144,6 @@ def read(self, slice=None): of a group of images """ - # Print("Inside Adapter:", slice) if slice is None: return with_object_cache(self._cache_key, self._seq.asarray) if isinstance(slice, int):