Skip to content

Commit

Permalink
Change dropDepends unittests for github
Browse files Browse the repository at this point in the history
Cuegui MenuActions_tests.py's test_dropDepends
unittest no longer applies since the fn no longer
calls the pycue's dropDepends with a target
parameter. This is a bug fix to dropDepends and
now the fn iterates over each dependency and calls
"depend.satisfy" instead to remove since the
pycue'sdropDepends only applys to "one" depend
target, so it will not remove different multiple
different dependency types linked to the one frame.
Hence, this caused the Cuegui unittest to fail on
the Github PR. Opting to put the dropDepends test
in pycue (which didn't have one) and remove the test
in Cuegui, since Cuegui already has a test coverage
for depend.satisfy.
  • Loading branch information
roulaoregan-spi committed Feb 1, 2022
1 parent 0e033fe commit 0d9e6ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 0 additions & 12 deletions cuegui/tests/MenuActions_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,18 +942,6 @@ def test_markAsWaiting(self, yesNoMock):

self.job.markAsWaiting.assert_called_with(name=[frame_name])

@mock.patch('opencue.search.FrameSearch')
@mock.patch('cuegui.Utils.questionBoxYesNo', return_value=True)
def test_dropDepends(self, yesNoMock, frameSearchMock):
frame_name = 'arbitrary-frame-name'
frame = opencue.wrappers.frame.Frame(opencue.compiled_proto.job_pb2.Frame(name=frame_name))
depend = opencue.wrappers.depend.Depend(opencue.compiled_proto.depend_pb2.Depend())

frame.getWhatThisDependsOn = lambda: [depend]
frame.dropDepends = mock.Mock()

self.frame_actions.dropDepends(rpcObjects=[frame])

@mock.patch('cuegui.DependWizard.DependWizard')
def test_dependWizard(self, dependWizardMock):
frames = [opencue.wrappers.frame.Frame()]
Expand Down
13 changes: 13 additions & 0 deletions pycue/tests/wrappers/frame_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,19 @@ def testMarkAsWaiting(self, getStubMock):
stubMock.MarkAsWaiting.assert_called_with(
job_pb2.FrameMarkAsWaitingRequest(frame=frame.data), timeout=mock.ANY)

def testDropDepends(self, getStubMock):
stubMock = mock.Mock()
stubMock.DropDepends.return_value = job_pb2.FrameDropDependsResponse()
getStubMock.return_value = stubMock

target = depend_pb2.ANY_TARGET
frame = opencue.wrappers.frame.Frame(job_pb2.Frame(name='arbitrary-frame-name'))
frame.dropDepends(target)

stubMock.DropDepends.assert_called_with(
job_pb2.FrameDropDependsRequest(frame=frame.data, target=target),
timeout=mock.ANY)

def testRunTimeZero(self, getStubMock):
zeroFrame = opencue.wrappers.frame.Frame(
job_pb2.Frame(name=TEST_FRAME_NAME, start_time=0, stop_time=1000))
Expand Down

0 comments on commit 0d9e6ed

Please sign in to comment.