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

Add Python 3.11 to the testing matrix #22

Merged
merged 5 commits into from
Jan 17, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
- '3.8'
- '3.9'
- '3.10'
runs-on: ubuntu-latest
- '3.11'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
1 change: 0 additions & 1 deletion .omeroci/scripts-copy
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ set -x

cd $TARGET
echo No-op: scripts could potentially be renamed to "core" or "internal"
/opt/omero/server/venv3/bin/pip install mox3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ def read(fname):
"omero-py", # requires Ice (use wheel for faster installs)
],
python_requires='>=3',
tests_require=['pytest'])
tests_require=['pytest', 'pytest-mock'])
9 changes: 2 additions & 7 deletions test/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
# Python 2
from path import path
from omero.util import ServerContext
from mox3 import mox
from functools import wraps
from omero.util.temp_files import create_path
from fsDropBoxMonitorClient import MonitorClientI
Expand Down Expand Up @@ -352,15 +351,10 @@ def addObjectFactory(self, *args):
class MockServerContext(ServerContext):

def __init__(self, ic, get_root):
self.mox = mox.Mox()
self.communicator = ic
self.getSession = get_root
self.stop_event = threading.Event()

def newSession(self, *args):
sess = self.mox.CreateMock(omero.api.ServiceFactoryPrx.__class__)
return sess


class MockMonitor(MonitorClientI):

Expand All @@ -381,9 +375,10 @@ def __init__(self, dir=None, pre=None, post=None):
post = []
self.root = None
ic = mock_communicator()
self.ctx = MockServerContext(ic, self.get_root)
MonitorClientI.__init__(
self, dir, ic, getUsedFiles=self.used_files,
ctx=MockServerContext(ic, self.get_root), worker_wait=0.1)
ctx=self.ctx, worker_wait=0.1)
self.log = logging.getLogger("MockMonitor")
self.events = []
self.files = {}
Expand Down
16 changes: 8 additions & 8 deletions test/unit/test_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,27 @@ def testBadFileId(self):
def testEmptyAdd(self):
MockMonitor().fsEventHappened('', []) # Does nothing.

@pytest.mark.broken(ticket="12566")
@with_driver
def testBasicAdd(self):
def testBasicAdd(self, mocker):
mocker.patch.object(self.client.ctx,'newSession', autospec=True)
self.driver.add(DirInfoEvent(1, monitors.EventInfo(
self.dir / "root" / "dirtimeout",
monitors.EventType.Create)))
self.driver.run()

@pytest.mark.broken(ticket="12566")
@with_driver
def testWithSingleImport(self):
def testWithSingleImport(self, mocker):
mocker.patch.object(self.client.ctx,'newSession', autospec=True)
f = self.dir / "root" / "file"
self.client.files = {str(f): [str(f)]}
self.driver.add(DirInfoEvent(0, monitors.EventInfo(
self.dir / "root" / "file", monitors.EventType.Create)))
self.driver.run()
time.sleep(0.25)

@pytest.mark.broken(ticket="12566")
@with_driver
def testWithMultiImport(self):
def testWithMultiImport(self, mocker):
mocker.patch.object(self.client.ctx,'newSession', autospec=True)
f1 = str(self.dir / "root" / "file1")
f2 = str(self.dir / "root" / "file2")
f3 = str(self.dir / "root" / "file3")
Expand All @@ -79,9 +79,9 @@ def testWithMultiImport(self):
time.sleep(1)
self.driver.run()

@pytest.mark.broken(ticket="12566")
@with_driver
def testDirectoryInDirectory(self):
def testDirectoryInDirectory(self, mocker):
mocker.patch.object(self.client.ctx,'newSession', autospec=True)
self.driver.add(DirInfoEvent(1, monitors.EventInfo(
self.dir / "root" / "dir", monitors.EventType.Create)))
self.driver.add(DirInfoEvent(1, monitors.EventInfo(
Expand Down
16 changes: 3 additions & 13 deletions test/unit/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,24 @@ def cb(*args):
class TestState(object):

def setup_method(self, method):
self.s = fsDBMC.MonitorState()
self.s = fsDBMC.MonitorState(None)
self.log = logging.getLogger(make_logname(self))

def teardown_method(self, method):
self.s.stop()

@pytest.mark.broken(ticket="12566")
def testEmpty(self):
self.s.update({}, 0, nullcb)

@pytest.mark.broken(ticket="12566")
def testSimple(self):
self.s.update({'file1': ['file1', 'file2']}, 0, nullcb)

@pytest.mark.broken(ticket="12566")
def testTimerCalled(self):
l = []
self.s.update({'file1': ['file1', 'file2']}, 0, listcb(l))
time.sleep(0.25)
assert 1 == len(l)

@pytest.mark.broken(ticket="12566")
def testMultipleInsert(self):
l = []
m = {
Expand All @@ -77,33 +73,29 @@ def testMultipleInsert(self):
time.sleep(0.25)
assert 1 == len(l)

@pytest.mark.broken(ticket="12566")
def testAddThenReAdd(self):
l = []
self.s.update({'file1': ['file1', 'file2']}, 0.1, listcb(l))
self.s.update({'file1': ['file1', 'file2']}, 0.1, listcb(l))
time.sleep(0.25)
assert 1 == len(l)

@pytest.mark.broken(ticket="12566")
def testAddThenModify(self):
l = []
self.s.update({'file1': ['file1', 'file2']}, 0.1, listcb(l))
self.s.update({'file1': ['file1', 'file3']}, 0.0, listcb(l))
time.sleep(0.25)
assert 1 == len(l)

@pytest.mark.broken(ticket="12566")
def testEntryMoved1(self):
l = []
self.s.update({'file1': ['file1']}, 0.1, listcb(l))
assert 1 == list(self.s.keys())
assert 1 == len(list(self.s.keys()))
self.s.update({'file2': ['file1', 'file2']}, 0.1, listcb(l))
assert 2 == list(self.s.keys())
assert 2 == len(list(self.s.keys()))
time.sleep(0.25)
assert 1 == len(l)

@pytest.mark.broken(ticket="12566")
def testEntryMoved2(self):
self.s.update(
{'file1': ['file1']}, 0.1, clearcb(self.log, self.s, 'file1'))
Expand All @@ -118,7 +110,6 @@ def testEntryMoved2(self):
assert 0 == len(list(self.s.keys()))
assert 0 == self.s.count()

@pytest.mark.broken(ticket="12566")
def testEntryOutOfSyncSubsume(self):
self.s.update({'file1': ['file1']}, 0.1, nullcb)
assert 1 == len(list(self.s.keys()))
Expand All @@ -127,7 +118,6 @@ def testEntryOutOfSyncSubsume(self):
self.s.update({'file2': ['file1', 'file2']}, 0.1, nullcb)
assert 2 == len(list(self.s.keys()))

@pytest.mark.broken(ticket="12566")
def testEntryOutOfSyncSteal(self):
self.s.update({'file1': ['file1', 'file3']}, 0.1, nullcb)
assert 2 == len(list(self.s.keys()))
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ deps =
future
numpy
pytest
pytest-mock
restructuredtext-lint
https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp38-cp38-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.8"
https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp39-cp39-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.9"
https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp310-cp310-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.10"
mox3
https://github.com/glencoesoftware/zeroc-ice-py-linux-x86_64/releases/download/20231024/zeroc_ice-3.6.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; platform_system=="Linux" and python_version=="3.11"
setenv =
ICE_CONFIG = {toxinidir}/ice.config
passenv =
Expand Down