Skip to content

Commit 8f87fcf

Browse files
authored
Fix for spaces in EDITOR env var (#102)
1 parent a01338a commit 8f87fcf

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ jobs:
1414
python-version: 3.x
1515
- run: |
1616
python -m pip install -r dev-requirements.txt
17+
- run: |
1718
pytest tests/

release.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@ def bump(tag):
215215
print('Please commit and use --tag')
216216

217217

218-
def manual_edit(fn):
219-
run_cmd([os.environ["EDITOR"], fn])
218+
def manual_edit(fn: str) -> None:
219+
editor = os.environ["EDITOR"].split()
220+
run_cmd([*editor, fn])
220221

221222

222223
@contextmanager

tests/test_release.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pytest
2+
from pytest_mock import MockerFixture
3+
4+
import release
5+
6+
7+
@pytest.mark.parametrize(
8+
["test_editor", "expected"],
9+
[
10+
("vim", ["vim", "README.rst"]),
11+
("bbedit --wait", ["bbedit", "--wait", "README.rst"]),
12+
],
13+
)
14+
def test_manual_edit(
15+
mocker: MockerFixture,
16+
monkeypatch: pytest.MonkeyPatch,
17+
test_editor: str,
18+
expected: list[str],
19+
) -> None:
20+
# Arrange
21+
monkeypatch.setenv("EDITOR", test_editor)
22+
mock_run_cmd = mocker.patch("release.run_cmd")
23+
24+
# Act
25+
release.manual_edit("README.rst")
26+
27+
# Assert
28+
mock_run_cmd.assert_called_once_with(expected)

0 commit comments

Comments
 (0)