Skip to content
This repository was archived by the owner on Nov 2, 2022. It is now read-only.

Commit b3e0d6c

Browse files
authored
Merge pull request #17 from WindSoilder/ci_format_check
fix CI check logic. And format code.
2 parents ebbe91d + 9f5b383 commit b3e0d6c

File tree

7 files changed

+17
-25
lines changed

7 files changed

+17
-25
lines changed

ci/travis.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pip install -U pip setuptools wheel
5555

5656
if [ "$CHECK_FORMATTING" = "1" ]; then
5757
pip install black
58-
if black --check --diff -l 79 setup.py exceptiongroup; then
58+
if ! black --check --diff setup.py exceptiongroup; then
5959
cat <<EOF
6060
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6161
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

exceptiongroup/_tests/test_scripts/ipython_custom_exc.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def custom_excepthook(*args):
1414
sys.excepthook = custom_excepthook
1515

1616
import IPython
17+
1718
ip = IPython.get_ipython()
1819

1920

exceptiongroup/_tests/test_scripts/simple_excepthook.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,4 @@ def exc2_fn():
1818

1919

2020
# This should be printed nicely, because we overrode sys.excepthook
21-
raise exceptiongroup.ExceptionGroup(
22-
"demo", [exc1_fn(), exc2_fn()], ["a", "b"],
23-
)
21+
raise exceptiongroup.ExceptionGroup("demo", [exc1_fn(), exc2_fn()], ["a", "b"])

exceptiongroup/_tests/test_tools.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_split_when_all_exception_matched():
2424
group = ExceptionGroup(
2525
"Many Errors",
2626
[RuntimeError("Runtime Error1"), RuntimeError("Runtime Error2")],
27-
["Runtime Error1", "Runtime Error2"]
27+
["Runtime Error1", "Runtime Error2"],
2828
)
2929
matched, unmatched = split(RuntimeError, group)
3030
assert matched is group
@@ -35,7 +35,7 @@ def test_split_when_all_exception_unmatched():
3535
group = ExceptionGroup(
3636
"Many Errors",
3737
[RuntimeError("Runtime Error1"), RuntimeError("Runtime Error2")],
38-
["Runtime Error1", "Runtime Error2"]
38+
["Runtime Error1", "Runtime Error2"],
3939
)
4040
matched, unmatched = split(ValueError, group)
4141
assert matched is None
@@ -46,31 +46,27 @@ def test_split_when_contains_matched_and_unmatched():
4646
error1 = RuntimeError("Runtime Error1")
4747
error2 = ValueError("Value Error2")
4848
group = ExceptionGroup(
49-
"Many Errors",
50-
[error1, error2],
51-
['Runtime Error1', 'Value Error2']
49+
"Many Errors", [error1, error2], ["Runtime Error1", "Value Error2"]
5250
)
5351
matched, unmatched = split(RuntimeError, group)
5452
assert isinstance(matched, ExceptionGroup)
5553
assert isinstance(unmatched, ExceptionGroup)
5654
assert matched.exceptions == [error1]
5755
assert matched.message == "Many Errors"
58-
assert matched.sources == ['Runtime Error1']
56+
assert matched.sources == ["Runtime Error1"]
5957
assert unmatched.exceptions == [error2]
6058
assert unmatched.message == "Many Errors"
61-
assert unmatched.sources == ['Value Error2']
59+
assert unmatched.sources == ["Value Error2"]
6260

6361

6462
def test_split_with_predicate():
6563
def _match(err):
66-
return str(err) != 'skip'
64+
return str(err) != "skip"
6765

6866
error1 = RuntimeError("skip")
6967
error2 = RuntimeError("Runtime Error")
7068
group = ExceptionGroup(
71-
"Many Errors",
72-
[error1, error2],
73-
['skip', 'Runtime Error']
69+
"Many Errors", [error1, error2], ["skip", "Runtime Error"]
7470
)
7571
matched, unmatched = split(RuntimeError, group, match=_match)
7672
assert matched.exceptions == [error2]

exceptiongroup/_tools.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,9 @@ def __exit__(self, etype, exc, tb):
124124
exceptiongroup_catch_exc = handler_exc
125125
else:
126126
exceptiongroup_catch_exc = ExceptionGroup(
127-
"caught {}".format(
128-
self._exc_type.__class__.__name__
129-
),
127+
"caught {}".format(self._exc_type.__class__.__name__),
130128
[handler_exc, rest],
131-
["exception raised by handler", "uncaught exceptions"]
129+
["exception raised by handler", "uncaught exceptions"],
132130
)
133131
else:
134132
exceptiongroup_catch_exc = rest

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ filename = "docs/source/history.rst"
44
directory = "newsfragments"
55
underlines = ["-", "~", "^"]
66
issue_format = "`#{issue} <https://github.com/python-trio/exceptiongroup/issues/{issue}>`__"
7+
8+
[tool.black]
9+
line-length = 79

setup.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@
1414
author_email="[email protected]",
1515
license="MIT -or- Apache License 2.0",
1616
packages=find_packages(),
17-
install_requires=[
18-
"trio",
19-
],
20-
keywords=[
21-
"async", "exceptions", "error handling",
22-
],
17+
install_requires=["trio"],
18+
keywords=["async", "exceptions", "error handling"],
2319
python_requires=">=3.5",
2420
classifiers=[
2521
"License :: OSI Approved :: MIT License",

0 commit comments

Comments
 (0)