Skip to content

Commit

Permalink
feedback for input runner
Browse files Browse the repository at this point in the history
  • Loading branch information
smythi93 committed Jul 19, 2023
1 parent 02d39ce commit e680ad9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "sflkit"
version = "0.2.2"
version = "0.2.3"
authors = [
{ name = "Marius Smytzek", email = "marius.smytzek@cispa.de" },
]
Expand Down
2 changes: 1 addition & 1 deletion src/sflkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sflkit.config import Config, parse_config
from sflkit.instrumentation.dir_instrumentation import DirInstrumentation

__version__ = "0.2.2"
__version__ = "0.2.3"


def instrument_config(conf: Config, event_dump: str = None):
Expand Down
21 changes: 14 additions & 7 deletions src/sflkit/runners/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil
import subprocess
from pathlib import Path
from typing import List, Dict, Optional, Any
from typing import List, Dict, Optional, Any, Tuple

Environment = Dict[str, str]

Expand Down Expand Up @@ -251,6 +251,7 @@ def __init__(
self.access = access
self.passing: Dict[str, List[str]] = self._prepare_tests(passing, "passing")
self.failing: Dict[str, List[str]] = self._prepare_tests(failing, "failing")
self.output: Dict[str, Tuple[str, str]] = dict()

@staticmethod
def _prepare_tests(tests: List[str | List[str]], prefix: str):
Expand All @@ -263,17 +264,23 @@ def get_tests(self, directory: Path, environ: Environment = None) -> List[str]:
return list(self.passing.keys()) + list(self.failing.keys())

def run_test(
self, directory: Path, test: str, environ: Environment = None
self, directory: Path, test_name: str, environ: Environment = None
) -> TestResult:
if "passing" in test:
test = self.passing[test]
if "passing" in test_name:
test = self.passing[test_name]
result = TestResult.PASSING
else:
test = self.failing[test]
test = self.failing[test_name]
result = TestResult.FAILING
subprocess.run(
["python", "-m", self.access] + test,
process = subprocess.run(
["python", self.access] + test,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=environ,
cwd=directory,
)
self.output[test_name] = (
process.stdout.decode("utf8"),
process.stderr.decode("utf8"),
)
return result

0 comments on commit e680ad9

Please sign in to comment.