Skip to content

Commit a98f32e

Browse files
authored
Test on multiple python 3.x (#422)
1 parent 0c446c6 commit a98f32e

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
language: python
2-
python:
2+
python:
3+
- '3.5'
34
- '3.6'
5+
- '3.7'
6+
- '3.8'
47
cache:
58
pip: true
69
directories:

jupyterlab_git/tests/test_execute.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ async def remove_lock_file(*args):
1919

2020
assert "unlock" in repr(execution_lock)
2121
cmd = ["git", "dummy"]
22-
kwargs = {"cwd": f"{tmp_path!s}"}
22+
kwargs = {"cwd": "{!s}".format(tmp_path)}
2323
await execute(cmd, **kwargs)
2424
assert "unlock" in repr(execution_lock)
2525

2626
assert not lock_file.exists()
27-
sleep.assert_called_once()
27+
assert sleep.call_count == 1

jupyterlab_git/tests/test_handlers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import tornado
66

7+
from jupyterlab_git.git import Git
78
from jupyterlab_git.handlers import (
89
GitAllHistoryHandler,
910
GitBranchHandler,
@@ -25,7 +26,7 @@ def test_mapping_added():
2526

2627

2728
class TestAllHistory(ServerTest):
28-
@patch("jupyterlab_git.handlers.GitAllHistoryHandler.git")
29+
@patch("jupyterlab_git.handlers.GitAllHistoryHandler.git", spec=Git)
2930
def test_all_history_handler_localbranch(self, mock_git):
3031
# Given
3132
show_top_level = {"code": 0, "foo": "top_level"}
@@ -62,7 +63,7 @@ def test_all_history_handler_localbranch(self, mock_git):
6263

6364

6465
class TestBranch(ServerTest):
65-
@patch("jupyterlab_git.handlers.GitBranchHandler.git")
66+
@patch("jupyterlab_git.handlers.GitBranchHandler.git", spec=Git)
6667
def test_branch_handler_localbranch(self, mock_git):
6768
# Given
6869
branch = {
@@ -126,7 +127,7 @@ def test_branch_handler_localbranch(self, mock_git):
126127

127128

128129
class TestLog(ServerTest):
129-
@patch("jupyterlab_git.handlers.GitLogHandler.git")
130+
@patch("jupyterlab_git.handlers.GitLogHandler.git", spec=Git)
130131
def test_log_handler(self, mock_git):
131132
# Given
132133
log = {"code": 0, "commits": []}
@@ -143,7 +144,7 @@ def test_log_handler(self, mock_git):
143144
payload = response.json()
144145
assert payload == log
145146

146-
@patch("jupyterlab_git.handlers.GitLogHandler.git")
147+
@patch("jupyterlab_git.handlers.GitLogHandler.git", spec=Git)
147148
def test_log_handler_no_history_count(self, mock_git):
148149
# Given
149150
log = {"code": 0, "commits": []}
@@ -162,7 +163,7 @@ def test_log_handler_no_history_count(self, mock_git):
162163

163164

164165
class TestPush(ServerTest):
165-
@patch("jupyterlab_git.handlers.GitPushHandler.git")
166+
@patch("jupyterlab_git.handlers.GitPushHandler.git", spec=Git)
166167
def test_push_handler_localbranch(self, mock_git):
167168
# Given
168169
mock_git.get_current_branch.return_value = maybe_future("foo")
@@ -184,7 +185,7 @@ def test_push_handler_localbranch(self, mock_git):
184185
payload = response.json()
185186
assert payload == {"code": 0}
186187

187-
@patch("jupyterlab_git.handlers.GitPushHandler.git")
188+
@patch("jupyterlab_git.handlers.GitPushHandler.git", spec=Git)
188189
def test_push_handler_remotebranch(self, mock_git):
189190
# Given
190191
mock_git.get_current_branch.return_value = maybe_future("foo")
@@ -208,7 +209,7 @@ def test_push_handler_remotebranch(self, mock_git):
208209
payload = response.json()
209210
assert payload == {"code": 0}
210211

211-
@patch("jupyterlab_git.handlers.GitPushHandler.git")
212+
@patch("jupyterlab_git.handlers.GitPushHandler.git", spec=Git)
212213
def test_push_handler_noupstream(self, mock_git):
213214
# Given
214215
mock_git.get_current_branch.return_value = maybe_future("foo")
@@ -233,7 +234,7 @@ def test_push_handler_noupstream(self, mock_git):
233234

234235

235236
class TestUpstream(ServerTest):
236-
@patch("jupyterlab_git.handlers.GitUpstreamHandler.git")
237+
@patch("jupyterlab_git.handlers.GitUpstreamHandler.git", spec=Git)
237238
def test_upstream_handler_localbranch(self, mock_git):
238239
# Given
239240
mock_git.get_current_branch.return_value = maybe_future("foo")

0 commit comments

Comments
 (0)