Skip to content

Commit 73032f7

Browse files
authored
Merge pull request #672 from robtaylor/python-3.12
Enable python =>3.9 <=3.12, and fix so checks work on OSX
2 parents 7865edf + 7fe35ee commit 73032f7

File tree

11 files changed

+68
-163
lines changed

11 files changed

+68
-163
lines changed

.pylint.ini

+3-2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ disable=
8787
logging-fstring-interpolation,
8888
unnecessary-dunder-call,
8989
deprecated-module,
90+
deprecated-argument,
9091

9192
# Enable the message, report, category or checker with the given id(s). You can
9293
# either give multiple identifier separated by comma (,) or put this option
@@ -418,5 +419,5 @@ known-third-party=enchant
418419
[EXCEPTIONS]
419420

420421
# Exceptions that will emit a warning when being caught. Defaults to
421-
# "Exception"
422-
overgeneral-exceptions=Exception
422+
# "builtin.Exception"
423+
overgeneral-exceptions=builtin.Exception

.verchew.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ version = GNU Make
55

66
[Python]
77

8-
cli = python
8+
cli = python3
99
version = 3.9 || 3.10 || 3.11 || 3.12
1010

1111
[Poetry]
1212

1313
cli = poetry
14-
version = 1.7
14+
version = 1.7 || 1.8
1515

1616
[Graphviz]
1717

1818
cli = dot
1919
cli_version_arg = -V
20-
version = 9 || 10
20+
version = 9 || 10 || 11 || 12
2121
optional = true
2222
message = This is only needed to generate UML diagrams for documentation.

bin/checksum

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
import hashlib

bin/verchew

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
# The MIT License (MIT)

doorstop/cli/commands.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ def run_export(args, cwd, error, catch=True, auto=False, _tree=None):
502502
ext = utilities.get_ext(args, error, ".yml", ".csv", whole_tree=whole_tree)
503503

504504
# Get the tree or document
505+
document = None
506+
505507
with utilities.capture(catch=catch) as success:
506508
exporter.check(ext)
507509
tree = _tree or _get_tree(args, cwd, load=whole_tree)
@@ -547,6 +549,7 @@ def run_publish(args, cwd, error, catch=True):
547549
ext = utilities.get_ext(args, error, ".txt", ".html", whole_tree)
548550

549551
# Get the tree or document
552+
document = None
550553
with utilities.capture(catch=catch) as success:
551554
publisher.check(ext)
552555
tree = _get_tree(args, cwd, load=whole_tree)
@@ -665,12 +668,10 @@ def _iter_items(args, tree, error):
665668
if item:
666669
yield item
667670
elif document:
668-
for item in document:
669-
yield item
671+
yield from document
670672
else:
671673
for document in tree:
672-
for item in document:
673-
yield item
674+
yield from document
674675

675676

676677
def _export_import(args, cwd, error, document, ext):

doorstop/cli/main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ def main(args=None): # pylint: disable=R0915
179179
log.error(exc)
180180
success = False
181181
except KeyboardInterrupt:
182-
log.debug("command cancelled")
182+
log.debug(f"command cancelled: {args}")
183183
success = False
184184
if success:
185-
log.debug("command succeeded")
185+
log.debug("command succeeded: {args}")
186186
else:
187-
log.debug("command failed")
187+
log.debug(f"command failed: {args}")
188188
sys.exit(1)
189189

190190

doorstop/common.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ def read_lines(path, encoding="utf-8"):
107107
"""
108108
log.trace("reading lines from '{}'...".format(path)) # type: ignore
109109
with open(path, "r", encoding=encoding) as stream:
110-
for line in stream:
111-
yield line
110+
yield from stream
112111

113112

114113
def read_text(path):

doorstop/core/editor.py

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ def launch(path, tool=None):
9494
args = ["start", path]
9595
elif os.name == "posix":
9696
args = ["xdg-open", path]
97+
else:
98+
raise DoorstopError(
99+
"unknown operating system, unable to determine launch command"
100+
)
97101

98102
# Launch the editor
99103
try:

doorstop/core/tests/test_item.py

+10
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,16 @@ def test_launch_os_posix(self, mock_call):
507507
self.assertRaises(DoorstopError, doorstop.core.editor.launch, "")
508508
mock_call.assert_called_once_with(["xdg-open", ""])
509509

510+
@patch("doorstop.core.editor.os.name", "unknown")
511+
@patch("doorstop.core.editor.sys.platform", "unknown")
512+
@patch("doorstop.core.editor.shutil.which")
513+
@patch("doorstop.core.editor._call")
514+
def test_launch_os_unknown(self, mock_call, mock_which):
515+
mock_call.side_effect = FileNotFoundError
516+
mock_which.return_value = "unknown"
517+
self.assertRaises(DoorstopError, doorstop.core.editor.launch, "")
518+
mock_call.assert_not_called()
519+
510520
def test_link(self):
511521
"""Verify links can be added to an item."""
512522
self.item.link("abc")

poetry.lock

+27-144
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+10-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ classifiers = [
4343

4444
[tool.poetry.dependencies]
4545

46-
python = "^3.9"
46+
python = "<3.13,>=3.9"
4747

4848
pyyaml = "^6.0"
4949
markdown = "^3.3.3"
@@ -54,6 +54,7 @@ python-markdown-math = "~0.6"
5454
plantuml-markdown = "^3.4.2"
5555
six = "*" # fixes https://github.com/dougn/python-plantuml/issues/11
5656
openpyxl = ">=3.1.2"
57+
verchew = "^3.4.2"
5758

5859
[tool.poetry.dev-dependencies]
5960

@@ -62,9 +63,9 @@ black = "^24.3"
6263
isort = "^5.12"
6364

6465
# Linters
65-
mypy = "^1.1.1"
66+
mypy = ">=1.1.1"
6667
pydocstyle = "*"
67-
pylint = "~2.15"
68+
pylint = "~3.2.0"
6869
types-markdown = "*"
6970
types-pyyaml = "*"
7071
types-requests = "*"
@@ -106,6 +107,12 @@ quiet = true
106107

107108
profile = "black"
108109

110+
[tool.pytest.ini_options]
111+
# log_cli = true
112+
# log_cli_level = "WARNING"
113+
log_file = "pytest.log"
114+
log_file_level = "DEBUG"
115+
109116
[build-system]
110117

111118
requires = ["poetry-core"]

0 commit comments

Comments
 (0)