Skip to content

Commit

Permalink
Merge pull request #591 from padraic-shafer/cleanup-print
Browse files Browse the repository at this point in the history
Cleanup extraneous print() statements in tests
  • Loading branch information
AbbyGi authored Oct 26, 2023
2 parents 7c122f9 + 4689af1 commit 81804e1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions tiled/_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions tiled/_tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down
2 changes: 1 addition & 1 deletion tiled/_tests/test_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion tiled/adapters/tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 81804e1

Please sign in to comment.