def test_file_not_modified_since(): fake_threshold = 10 fake_path = '/somepath' with contextlib.nested( mock.patch('time.time'), mock.patch('os.path.isfile', return_value=True), mock.patch('os.path.getmtime'), ) as ( mock_time, mock_isfile, mock_getmtime, ): mock_time.return_value = 10.0 mock_getmtime.return_value = mock_time.return_value + fake_threshold + 1 print configure_nerve.file_not_modified_since(fake_path, fake_threshold)
def test_file_not_modified_since(): fake_threshold = 10 fake_path = '/somepath' with patch('time.time') as mock_time, patch( 'os.path.isfile', return_value=True), patch('os.path.getmtime', ) as mock_getmtime: mock_time.return_value = 10.0 mock_getmtime.return_value = mock_time.return_value + fake_threshold + 1 print( configure_nerve.file_not_modified_since(fake_path, fake_threshold))