Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53ddf38

Browse files
authored
Merge pull request#1798 from EliahKagan/no-sumtypes
Remove test dependency on sumtypes library
2 parentsfd29dfd +70ea7ec commit53ddf38

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

‎test-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ pytest-cov
99
pytest-instafail
1010
pytest-mock
1111
pytest-sugar
12-
sumtypes

‎test/test_index.py

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

66
importcontextlib
7+
fromdataclassesimportdataclass
78
fromioimportBytesIO
89
importlogging
910
importos
@@ -17,7 +18,6 @@
1718

1819
importddt
1920
importpytest
20-
fromsumtypesimportconstructor,sumtype
2121

2222
fromgitimport (
2323
BlobFilter,
@@ -66,34 +66,48 @@ def _get_windows_ansi_encoding():
6666
returnf"cp{value}"
6767

6868

69-
@sumtype
7069
classWinBashStatus:
71-
"""Status of bash.exefor native Windows. Affectswhich commit hook tests can pass.
70+
"""Namespace ofnative-Windowsbash.exestatuses. Affectswhat hook tests can pass.
7271
7372
Call check() to check the status. (CheckError and WinError should not typically be
7473
used to trigger skip or xfail, because they represent unexpected situations.)
7574
"""
7675

77-
Inapplicable=constructor()
78-
"""This system is not native Windows: either not Windows at all, or Cygwin."""
76+
@dataclass
77+
classInapplicable:
78+
"""This system is not native Windows: either not Windows at all, or Cygwin."""
7979

80-
Absent=constructor()
81-
"""No command for bash.exe is found on the system."""
80+
@dataclass
81+
classAbsent:
82+
"""No command for bash.exe is found on the system."""
8283

83-
Native=constructor()
84-
"""Running bash.exe operates outside any WSL distribution (as with Git Bash)."""
84+
@dataclass
85+
classNative:
86+
"""Running bash.exe operates outside any WSL distribution (as with Git Bash)."""
8587

86-
Wsl=constructor()
87-
"""Running bash.exe calls bash in a WSL distribution."""
88+
@dataclass
89+
classWsl:
90+
"""Running bash.exe calls bash in a WSL distribution."""
8891

89-
WslNoDistro=constructor("process","message")
90-
"""Running bash.exe tries to run bash on a WSL distribution, but none exists."""
92+
@dataclass
93+
classWslNoDistro:
94+
"""Running bash.exe tries to run bash on a WSL distribution, but none exists."""
9195

92-
CheckError=constructor("process","message")
93-
"""Running bash.exe fails in an unexpected error or gives unexpected output."""
96+
process:"subprocess.CompletedProcess[bytes]"
97+
message:str
9498

95-
WinError=constructor("exception")
96-
"""bash.exe may exist but can't run. CreateProcessW fails unexpectedly."""
99+
@dataclass
100+
classCheckError:
101+
"""Running bash.exe fails in an unexpected error or gives unexpected output."""
102+
103+
process:"subprocess.CompletedProcess[bytes]"
104+
message:str
105+
106+
@dataclass
107+
classWinError:
108+
"""bash.exe may exist but can't run. CreateProcessW fails unexpectedly."""
109+
110+
exception:OSError
97111

98112
@classmethod
99113
defcheck(cls):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp