Skip to content

Commit

Permalink
fix mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Dec 25, 2018
1 parent d3c36bf commit 69a057c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ def pdh_mocks_fixture():
pdhaddcounter = mock.patch('win32pdh.AddCounter', mock_AddCounter)
pdhgetformattedcountervalue = mock.patch('win32pdh.GetFormattedCounterValue', mock_GetFormattedCounterValue)
pdhcollectquerydata = mock.patch('win32pdh.CollectQueryData', mock_CollectQueryData)
pdhvalidatepath = mock.patch('win32pdh.ValidatePath', mock_ValidatePath)

yield regqueryvalueex.start(), pdhlookupbyindex.start(), \
pdhenumobjectitems.start(), pdhmakecounterpath.start(), \
pdhaddcounter.start(), pdhgetformattedcountervalue.start(), pdhcollectquerydata.start()
pdhaddcounter.start(), pdhgetformattedcountervalue.start(), pdhcollectquerydata.start(), \
pdhvalidatepath.start()

regqueryvalueex.stop()
pdhlookupbyindex.stop()
Expand All @@ -43,6 +45,7 @@ def pdh_mocks_fixture():
pdhaddcounter.stop()
pdhgetformattedcountervalue.stop()
pdhcollectquerydata.stop()
pdhvalidatepath.stop()


@pytest.fixture
Expand Down Expand Up @@ -216,3 +219,7 @@ def mock_QueryValueEx(*args, **kwargs):

def mock_QueryValueExWithRaise(*args, **kwargs):
raise WindowsError


def mock_ValidatePath(p):
return 0

0 comments on commit 69a057c

Please sign in to comment.