Skip to content

Commit

Permalink
Merge pull request #29 from asam-ev/2024-08-29
Browse files Browse the repository at this point in the history
Prepare for the review phase
  • Loading branch information
andreaskern74 authored Aug 29, 2024
2 parents 33a59f9 + 8f17b03 commit 1f7e955
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 50 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: pip install -r requirements.txt -r requirements-tests.txt
- run: python -m pytest -vv
- run: pip install poetry==1.8.3
- run: poetry install --with dev
- run: poetry run pytest -vv
84 changes: 50 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ to showcase the functionality and implementation (it shall not be a reference im
- [Installation and usage](#installation-and-usage)
- [Installation using pip](#installation-using-pip)
- [Installation from source](#installation-from-source)
- [Default Python](#default-python)
- [Poetry](#poetry)
- [Register Checker Bundle to ASAM Quality Checker Framework](#register-checker-bundle-to-asam-quality-checker-framework)
- [Linux Manifest Template](#linux-manifest-template)
- [Windows Manifest Template](#windows-manifest-template)
- [Example Configuration File](#example-configuration-file)
- [Tests](#tests)
- [Install using pip](#install-using-pip)
- [Install using poetry](#install-using-poetry)
- [Execute tests](#execute-tests)
- [Contributing](#contributing)


Expand Down Expand Up @@ -57,20 +54,7 @@ python -m qc_otx.main --help

### Installation from source

After cloning the repository, there are two options to install from source.

1. Default Python on the machine
2. [Poetry](https://python-poetry.org/)

#### Default Python

```bash
pip install -r requirements.txt
```

This will install the needed dependencies to your local Python.

#### Poetry
After cloning the repository, the project can be installed using [Poetry](https://python-poetry.org/).

```bash
poetry install
Expand All @@ -86,29 +70,67 @@ python -m qc_otx.main --help

## Register Checker Bundle to ASAM Quality Checker Framework

Manifest file templates are provided in the [manifest_templates](manifest_templates/) folder to register the ASAM OpenDrive Checker Bundle with the [ASAM Quality Checker Framework](https://github.com/asam-ev/qc-framework/tree/main).
Manifest file templates are provided in the [manifest_templates](manifest_templates/) folder to register the ASAM OTX Checker Bundle with the [ASAM Quality Checker Framework](https://github.com/asam-ev/qc-framework/tree/main).

### Linux Manifest Template

To register this Checker Bundle in Linux, use the [linux_manifest.json](manifest_templates/linux_manifest.json) template file. Replace the path to the Python executable `/home/user/.venv/bin/python` in the `exec_command` with the path to the Python executable where the Checker Bundle is installed.
To register this Checker Bundle in Linux, use the [linux_otx_manifest.json](manifest_templates/linux_otx_manifest.json) template file.

## Tests
If the asam-qc-otx is installed in a virtual environment, the `exec_command` needs to be adjusted as follows:

To run the tests, you need to install the extra test dependency after installing from source.
```json
"exec_command": "source <venv>/bin/activate && cd $ASAM_QC_FRAMEWORK_WORKING_DIR && qc_otx -c $ASAM_QC_FRAMEWORK_CONFIG_FILE"
```

### Install using pip
Replace `<venv>/bin/activate` by the path to your virtual environment.

```bash
pip install -r requirements-tests.txt
### Windows Manifest Template

To register this Checker Bundle in Windows, use the [windows_otx_manifest.json](manifest_templates/windows_otx_manifest.json) template file.

If the asam-qc-otx is installed in a virtual environment, the `exec_command` needs to be adjusted as follows:

```json
"exec_command": "C:\\> <venv>\\Scripts\\activate.bat && cd %ASAM_QC_FRAMEWORK_WORKING_DIR% && qc_otx -c %ASAM_QC_FRAMEWORK_CONFIG_FILE%"
```

### Install using poetry
Replace `C:\\> <venv>\\Scripts\\activate.bat` by the path to your virtual environment.

### Example Configuration File

An example configuration file for using this Checker Bundle within the ASAM Quality Checker Framework is as follows.

```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Config>

<Param name="InputFile" value="test.otx" />

<CheckerBundle application="otxBundle">
<Param name="resultFile" value="otx_bundle_report.xqar" />
<Checker checkerId="core_otx" maxLevel="1" minLevel="3" />
<Checker checkerId="data_type_otx" maxLevel="1" minLevel="3" />
<Checker checkerId="zip_file_otx" maxLevel="1" minLevel="3" />
<Checker checkerId="state_machine_otx" maxLevel="1" minLevel="3" />
</CheckerBundle>

<ReportModule application="TextReport">
<Param name="strInputFile" value="Result.xqar" />
<Param name="strReportFile" value="Report.txt" />
</ReportModule>

</Config>
```

## Tests

To run the tests, you need to install the extra test dependency after installing from source.

```bash
poetry install --with dev
```

### Execute tests
To execute tests:

```bash
python -m pytest -vv
Expand All @@ -134,12 +156,6 @@ You can check more options for pytest at its [own documentation](https://docs.py
For contributing, you need to install the development requirements besides the
test and installation requirements, for that run:

```bash
pip install -r requirements-dev.txt
```

or

```bash
poetry install --with dev
```
Expand Down
10 changes: 0 additions & 10 deletions manifest_templates/linux_manifest.json

This file was deleted.

10 changes: 10 additions & 0 deletions manifest_templates/linux_otx_manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"module": [
{
"name": "otxBundle",
"exec_type": "executable",
"module_type": "checker_bundle",
"exec_command": "cd $ASAM_QC_FRAMEWORK_WORKING_DIR && qc_otx -c $ASAM_QC_FRAMEWORK_CONFIG_FILE"
}
]
}
10 changes: 10 additions & 0 deletions manifest_templates/windows_otx_manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"module": [
{
"name": "otxBundle",
"exec_type": "executable",
"module_type": "checker_bundle",
"exec_command": "cd %ASAM_QC_FRAMEWORK_WORKING_DIR% && qc_otx -c %ASAM_QC_FRAMEWORK_CONFIG_FILE%"
}
]
}
3 changes: 3 additions & 0 deletions qc_otx/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from qc_otx import main

main.main()
1 change: 0 additions & 1 deletion requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements-tests.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

0 comments on commit 1f7e955

Please sign in to comment.