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

Unit tests: clean up warnings #386

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions test/unit/clitest/test_sess.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ def testSessionReattachConflictingPort(self, connection, port, group):
connection, name=None, port=port[1], group=group)
with pytest.raises(NonZeroReturnCode):
cli.invoke(["s", "login", "-k", "%s" % MOCKKEY] + key_conn_args)
cli.STORE.clear(testhost, testuser)

@pytest.mark.parametrize('connection', CONNECTION_TYPES)
@pytest.mark.parametrize('port', ALL_PORTS)
Expand Down Expand Up @@ -706,6 +707,7 @@ def testSessionReattachFailsPortGroup(self, connection, port, group):
connection, name=None, port=port[1], group=group[1])
with pytest.raises(NonZeroReturnCode):
cli.invoke(["s", "login", "-k", "%s" % MOCKKEY] + key_conn_args)
cli.STORE.clear(testhost, testuser)

@pytest.mark.parametrize('port', ALL_PORTS)
@pytest.mark.parametrize('connection', CONNECTION_TYPES)
Expand Down
7 changes: 6 additions & 1 deletion test/unit/tablestest/test_hdfstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import omero.hdfstorageV2 as storage_module
import sys
import warnings

if sys.platform.startswith("win"):
pytest.skip("skipping tests on windows", allow_module_level=True)
Expand Down Expand Up @@ -344,7 +345,11 @@ def testNonNaturalNameWarning(self, name):
hdf = HdfStorage(self.hdfpath(), self.lock)
cols = [omero.columns.StringColumnI(
name, "A column with non natural name", bytesize, None)]
hdf.initialize(cols)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
hdf.initialize(cols)
assert len(w) == 1
assert issubclass(w[-1].category, tables.NaturalNameWarning)
cols[0].settable(hdf._HdfStorage__mea) # Needed for size
cols[0].values = ["foo", "bar"]
hdf.append(cols)
Expand Down