8000 Update references to mock in Issues tests · davidmoss/github3.py@d381ed8 · GitHub
[go: up one dir, main page]

Skip to content

Commit d381ed8

Browse files
committed
Update references to mock in Issues tests
1 parent 1ddbc73 commit d381ed8

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/test_issues.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
from github3.issues.milestone import Milestone
66
from github3.issues import Issue
77
import datetime
8-
from tests.utils import BaseCase, load
9-
try:
10-
from unittest.mock import patch
11-
except ImportError:
12-
from mock import patch
8+
from tests.utils import BaseCase, load, mock
139

1410

1511
class TestLabel(BaseCase):
@@ -171,7 +167,7 @@ def test_assign(self):
171167

172168
self.login()
173169

174-
with patch.object(Issue, 'edit') as ed:
170+
with mock.patch.object(Issue, 'edit') as ed:
175171
ed.return_value = True
176172
assert self.i.assign(None) is False
177173
self.not_called()
@@ -189,7 +185,7 @@ def test_close(self):
189185
self.not_called()
190186
self.login()
191187

192-
with patch.object(Issue, 'edit') as ed:
188+
with mock.patch.object(Issue, 'edit') as ed:
193189
ed.return_value = True
194190
assert self.i.close()
195191
u = self.i.assignee.login if self.i.assignee else ''
@@ -277,7 +273,7 @@ def test_remove_all_labels(self):
277273

278274
self.login()
279275

280-
with patch.object(Issue, 'replace_labels') as rl:
276+
with mock.patch.object(Issue, 'replace_labels') as rl:
281277
rl.return_value = []
282278
assert self.i.remove_all_labels() == []
283279
rl.assert_called_once_with([])
@@ -303,7 +299,7 @@ def test_reopen(self):
303299
n = self.i.milestone.number if self.i.milestone else None
304300
u = self.i.assignee.login if self.i.assignee else None
305301

306-
with patch.object(Issue, 'edit') as ed:
302+
with mock.patch.object(Issue, 'edit') as ed:
307303
ed.return_value = True
308304
assert self.i.reopen()
309305
labels = [str(l) for l in self.i.labels]

0 commit comments

Comments
 (0)
0