Skip to content

Commit

Permalink
feat: add marker to base test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
xxthunder committed Dec 20, 2024
1 parent 80a8b2d commit 0b69db3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/spl_core/test_utils/base_variant_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pathlib import Path
from typing import List

import pytest

from spl_core.test_utils.spl_build import SplBuild


Expand Down Expand Up @@ -57,6 +59,7 @@ def assert_artifact_exists(self, dir: Path, artifact: Path) -> None:
else:
assert Path.joinpath(dir, artifact).exists(), f"Artifact {Path.joinpath(dir, artifact)} does not exist" # noqa: S101

@pytest.mark.build
def test_build(self) -> None:
spl_build: SplBuild = SplBuild(variant=self.variant, build_kit="prod")
assert 0 == spl_build.execute(target="all") # noqa: S101
Expand All @@ -68,12 +71,14 @@ def test_build(self) -> None:
if self.create_artifacts_json:
spl_build.create_artifacts_json(self.expected_archive_artifacts)

def test_unittest(self) -> None:
@pytest.mark.unittests
def test_unittests(self) -> None:
spl_build: SplBuild = SplBuild(variant=self.variant, build_kit="test")
assert 0 == spl_build.execute(target="unittests") # noqa: S101
for artifact in self.expected_test_artifacts:
self.assert_artifact_exists(dir=spl_build.build_dir, artifact=artifact)

@pytest.mark.reports
def test_reports(self) -> None:
spl_build: SplBuild = SplBuild(variant=self.variant, build_kit="test")
assert 0 == spl_build.execute(target="all") # noqa: S101
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_base_variant_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def test_build(self, mock_execute: MagicMock, mock_exists: MagicMock) -> None:

@patch("pathlib.Path.exists", return_value=True)
@patch("spl_core.test_utils.spl_build.SplBuild.execute")
def test_unittest(self, mock_execute: MagicMock, mock_exists: MagicMock) -> None:
def test_unittests(self, mock_execute: MagicMock, mock_exists: MagicMock) -> None:
mock_execute.return_value = 0
super().test_unittest()
super().test_unittests()
mock_execute.assert_called_once_with(target="unittests")
mock_exists.assert_any_call()

Expand Down

0 comments on commit 0b69db3

Please sign in to comment.