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

Remove test dependency on sumtypes library#1798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 2 commits intogitpython-developers:mainfromEliahKagan:no-sumtypes
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletiontest-requirements.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,4 +9,3 @@ pytest-cov
pytest-instafail
pytest-mock
pytest-sugar
sumtypes
48 changes: 31 additions & 17 deletionstest/test_index.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import contextlib
from dataclasses import dataclass
from io import BytesIO
import logging
import os
Expand All@@ -17,7 +18,6 @@

import ddt
import pytest
from sumtypes import constructor, sumtype

from git import (
BlobFilter,
Expand DownExpand Up@@ -66,34 +66,48 @@ def _get_windows_ansi_encoding():
return f"cp{value}"


@sumtype
class WinBashStatus:
"""Status of bash.exefor native Windows. Affectswhich commit hook tests can pass.
"""Namespace ofnative-Windowsbash.exestatuses. Affectswhat hook tests can pass.

Call check() to check the status. (CheckError and WinError should not typically be
used to trigger skip or xfail, because they represent unexpected situations.)
"""

Inapplicable = constructor()
"""This system is not native Windows: either not Windows at all, or Cygwin."""
@dataclass
class Inapplicable:
"""This system is not native Windows: either not Windows at all, or Cygwin."""

Absent = constructor()
"""No command for bash.exe is found on the system."""
@dataclass
class Absent:
"""No command for bash.exe is found on the system."""

Native = constructor()
"""Running bash.exe operates outside any WSL distribution (as with Git Bash)."""
@dataclass
class Native:
"""Running bash.exe operates outside any WSL distribution (as with Git Bash)."""

Wsl = constructor()
"""Running bash.exe calls bash in a WSL distribution."""
@dataclass
class Wsl:
"""Running bash.exe calls bash in a WSL distribution."""

WslNoDistro = constructor("process", "message")
"""Running bash.exe tries to run bash on a WSL distribution, but none exists."""
@dataclass
class WslNoDistro:
"""Running bash.exe tries to run bash on a WSL distribution, but none exists."""

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

WinError = constructor("exception")
"""bash.exe may exist but can't run. CreateProcessW fails unexpectedly."""
@dataclass
class CheckError:
"""Running bash.exe fails in an unexpected error or gives unexpected output."""

process: "subprocess.CompletedProcess[bytes]"
message: str

@dataclass
class WinError:
"""bash.exe may exist but can't run. CreateProcessW fails unexpectedly."""

exception: OSError

@classmethod
def check(cls):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp