Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup extraneous print() statements in tests #591

Merged
merged 8 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading