You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# TODO: see if there is a better way to structure multiple parameterized fixtures
fromenumimportEnumfromtypingimportList, FinalimportpytestfromgitimportRepofromflexlate.ext_gitimportdelete_local_branchfromtests.gitutilsimportreset_n_commits_without_checkoutclassLocalBranchSituation(str, Enum):
UP_TO_DATE="up to date"DELETED="deleted"OUT_OF_DATE="out of date"defapply(self, repo: Repo, branch_name: str):
apply_local_branch_situation(repo, branch_name, self)
all_local_branch_situations: Final[List[LocalBranchSituation]] =list(
LocalBranchSituation
)
@pytest.fixture(scope="module", params=all_local_branch_situations)deflocal_branch_situation(request) ->LocalBranchSituation:
returnrequest.param# TODO: see if there is a better way to structure multiple parameterized fixtures# that actually resolve to the same value@pytest.fixture(scope="module", params=all_local_branch_situations)deftemplate_branch_situation(request) ->LocalBranchSituation:
returnrequest.param@pytest.fixture(scope="module", params=all_local_branch_situations)defoutput_branch_situation(request) ->LocalBranchSituation:
returnrequest.paramdefapply_local_branch_situation(
repo: Repo, branch_name: str, situation: LocalBranchSituation
):
ifsituation==LocalBranchSituation.UP_TO_DATE:
returnifsituation==LocalBranchSituation.DELETED:
returndelete_local_branch(repo, branch_name)
ifsituation==LocalBranchSituation.OUT_OF_DATE:
returnreset_n_commits_without_checkout(repo, branch_name)
raiseNotImplementedError(f"no handling for local branch situation {situation}")
7f058873b21c67c2af09f64137c33b4d0d58bbf9
The text was updated successfully, but these errors were encountered:
see if there is a better way to structure multiple parameterized fixtures
that actually resolve to the same value
flexlate/tests/fixtures/local_branch_situation.py
Line 30 in 06d8e5e
7f058873b21c67c2af09f64137c33b4d0d58bbf9
The text was updated successfully, but these errors were encountered: