Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test_on_every_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
done < ci/showcase_targets_run.txt
- name: Feature Integration Tests
run: |
bazel test --config bl-x86_64-linux //feature_integration_tests/python_test_cases:fit
bazel test --config bl-x86_64-linux //feature_integration_tests/test_cases:fit
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_depen
pip.parse(
hub_name = "pip_score_venv_test",
python_version = PYTHON_VERSION,
requirements_lock = "//feature_integration_tests/python_test_cases:requirements.txt.lock",
requirements_lock = "//feature_integration_tests/test_cases:requirements.txt.lock",
)

use_repo(pip, "pip_score_venv_test")
Expand Down
2 changes: 1 addition & 1 deletion autosd/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_depen
pip.parse(
hub_name = "pip_score_venv_test",
python_version = PYTHON_VERSION,
requirements_lock = "//feature_integration_tests/python_test_cases:requirements.txt.lock",
requirements_lock = "//feature_integration_tests/test_cases:requirements.txt.lock",
)
use_repo(pip, "pip_score_venv_test")

Expand Down
14 changes: 7 additions & 7 deletions feature_integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ This directory contains Feature Integration Tests for the S-CORE project. It inc

## Structure

- `python_test_cases/` — Python-based integration test cases
- `test_cases/` — Python-based integration test cases
- `conftest.py` — Pytest configuration and fixtures
- `fit_scenario.py` — Base scenario class
- `requirements.txt` — Python dependencies
- `BUILD` — Bazel build and test definitions
- `tests/` — Test cases (e.g., orchestration with persistency)
- `rust_test_scenarios/` — Rust-based integration test scenarios
- `test_scenarios/` — Rust-based integration test scenarios
- `src/` — Rust source code for test scenarios
- `BUILD` — Bazel build definitions

Expand All @@ -21,25 +21,25 @@ This directory contains Feature Integration Tests for the S-CORE project. It inc
Python tests are managed with Bazel and Pytest. To run the main test target:

```sh
bazel test //feature_integration_tests/python_test_cases:fit
bazel test //feature_integration_tests/test_cases:fit
```

### Rust Test Scenarios

Rust test scenarios are defined in `rust_test_scenarios/src/scenarios`. Build and run them using Bazel:
Rust test scenarios are defined in `test_scenarios/src/scenarios`. Build and run them using Bazel:

```sh
bazel build //feature_integration_tests/rust_test_scenarios
bazel build //feature_integration_tests/test_scenarios
```

```sh
bazel run //feature_integration_tests/rust_test_scenarios -- --list-scenarios
bazel run //feature_integration_tests/test_scenarios -- --list-scenarios
```

## Updating Python Requirements

To update Python dependencies:

```sh
bazel run //feature_integration_tests/python_test_cases:requirements.update
bazel run //feature_integration_tests/test_cases:requirements.update
```
9 changes: 0 additions & 9 deletions feature_integration_tests/python_test_cases/pytest.ini

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("@score_tooling//python_basics:defs.bzl", "score_py_pytest", "score_virtualenv")

# In order to update the requirements, change the `requirements.txt` file and run:
# `bazel run //feature_integration_tests/python_test_cases:requirements.update`.
# `bazel run //feature_integration_tests/test_cases:requirements.update`.
# This will update the `requirements.txt.lock` file.
# To upgrade all dependencies to their latest versions, run:
# `bazel run //feature_integration_tests/python_test_cases:requirements.update -- --upgrade`.
# `bazel run //feature_integration_tests/test_cases:requirements.update -- --upgrade`.
compile_pip_requirements(
name = "requirements",
srcs = [
Expand All @@ -28,14 +28,14 @@ score_virtualenv(
# Tests targets
score_py_pytest(
name = "fit",
srcs = glob(["tests/**/*.py"]) + ["conftest.py", "fit_scenario.py"],
srcs = glob(["tests/**/*.py"]) + glob(["internal/**/*.py"]) + ["conftest.py"],
args = [
"--traces=all",
"--rust-target-path=$(rootpath //feature_integration_tests/rust_test_scenarios)",
"--rust-target-path=$(rootpath //feature_integration_tests/test_scenarios/rust:test_scenarios)",
],
data = [
":python_tc_venv",
"//feature_integration_tests/rust_test_scenarios",
"//feature_integration_tests/test_scenarios/rust:test_scenarios",
],
env = {
"RUST_BACKTRACE": "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def pytest_addoption(parser):
parser.addoption(
"--rust-target-name",
type=str,
default="//feature_integration_tests/rust_test_scenarios:rust_test_scenarios",
default="//feature_integration_tests/test_scenarios/rust:test_scenarios",
help="Rust test scenario executable target.",
)
parser.addoption(
Expand Down Expand Up @@ -64,20 +64,3 @@ def pytest_sessionstart(session):

except Exception as e:
pytest.exit(str(e), returncode=1)


def pytest_collection_modifyitems(items: list[pytest.Function]):
markers_to_process = (
"PartiallyVerifies",
"FullyVerifies",
"Description",
"TestType",
"DerivationTechnique",
)
for item in items:
# Add custom markers info to XML report
for marker in item.iter_markers():
if marker.name not in markers_to_process:
continue

item.user_properties.append((marker.name, marker.args[0]))
32 changes: 32 additions & 0 deletions feature_integration_tests/test_cases/internal/dir_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import shutil
from pathlib import Path
from typing import Generator

import pytest


def temp_dir_common(
tmp_path_factory: pytest.TempPathFactory, base_name: str, *args: str
) -> Generator[Path, None, None]:
"""
Create temporary directory and remove it after test.
Common implementation to be reused by fixtures.

Returns generator providing numbered path to temporary directory.
E.g., '<TMP_PATH>/<BASE_NAME>-<ARG1>-<ARG2><NUMBER>/'.

Parameters
----------
tmp_path_factory : pytest.TempPathFactory
Factory for temporary directories.
base_name : str
Base directory name.
'self.__class__.__name__' use is recommended.
*args : Any
Other parameters to be included in directory name.
"""
parts = [base_name, *args]
dir_name = "-".join(parts)
dir_path = tmp_path_factory.mktemp(dir_name, numbered=True)
yield dir_path
shutil.rmtree(dir_path)
Loading
Loading