-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ py38-devel | |
py39-ansible29 | ||
py39-core | ||
py39-devel | ||
test | ||
test-requirements | ||
test-setup | ||
uninstall | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build | ||
install | ||
test | ||
uninstall | ||
up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import sys | ||
from typing import List, Optional | ||
|
||
from mk.exec import run_or_fail | ||
from mk.tools import Action, Tool | ||
|
||
|
||
class PyTestTool(Tool): | ||
"""Expose test command if pytest config is detected.""" | ||
|
||
name = "pytest" | ||
|
||
def __init__(self) -> None: | ||
super().__init__(self) | ||
|
||
def run(self, action: Optional[Action] = None) -> None: | ||
if not action: | ||
return | ||
if action.name == "test": | ||
cmd = [sys.executable, "-m", "pytest"] | ||
run_or_fail(cmd, tee=True) | ||
|
||
def is_present(self, path: str) -> bool: | ||
for name in ("pytest.ini",): | ||
if os.path.isfile(name): | ||
return True | ||
return False | ||
|
||
def actions(self) -> List[Action]: | ||
actions = [] | ||
actions.append( | ||
Action( | ||
name="test", | ||
tool=self, | ||
description="Run pytest", | ||
) | ||
) | ||
|
||
return actions |