Skip to content

Commit

Permalink
fix: Remove additional curly bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
doosuu committed Jan 19, 2024
1 parent ce38914 commit 37a6c51
Show file tree
Hide file tree
Showing 7 changed files with 7,821 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v5
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests/data/vss_3_0"]
path = tests/data/vss_3_0
url = https://github.com/COVESA/vehicle_signal_specification.git
2 changes: 1 addition & 1 deletion src/velocitas/model_generator/python/vss_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __gen_getter(self, name, instances, base_ctx):
f'raise IndexError(f"Index {{index}} is out of range [1, {count}]")\n'
)
body_ctx.dedent()
body_ctx.write("_options = {{\n")
body_ctx.write("_options = {\n")
body_ctx.indent()

for index in range(len(instances)):
Expand Down
1 change: 1 addition & 0 deletions tests/data/vss_3_0
Submodule vss_3_0 added at 525e2b
7,798 changes: 7,798 additions & 0 deletions tests/data/vss_rel_3.0.json

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions tests/test_model_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,31 @@
# SPDX-License-Identifier: Apache-2.0

import compileall
import subprocess
import sys
from pathlib import Path
from velocitas.model_generator import generate_model

import pytest
import subprocess
import sys
from velocitas.model_generator import generate_model

test_data_base_path = Path(__file__).parent.joinpath("data")


@pytest.mark.parametrize("language", ["python", "cpp"])
@pytest.mark.parametrize(
"language,vss_file", [("python", "vss_rel_3.0.json"), ("cpp", "vss_rel_3.0.json")]
"input_file_path,include_dir",
[
("vss_rel_3.0.json", "."),
("vss_3_0/spec/VehicleSignalSpecification.vspec", "vss_3_0/spec"),
],
)
def test_generate(language: str, vss_file: str):
input_file_path = Path(__file__).parent.joinpath(vss_file).__str__()
generate_model(input_file_path, language, "out", "vehicle")
def test_generate(language: str, input_file_path: str, include_dir: str):
input_file_path = Path(__file__).parent.joinpath("data", input_file_path).__str__()
generate_model(input_file_path, language, "output", "vehicle")

if language == "python":
subprocess.check_call([sys.executable, "-m", "pip", "install", "./out"])
compileall.compile_dir("./out", force=True)
subprocess.check_call([sys.executable, "-m", "pip", "install", "./output"])
assert compileall.compile_dir("./output", force=True)
elif language == "cpp":
# TODO: add a check if the package can be installed after generated model is a conan package
pass
1 change: 0 additions & 1 deletion tests/vss_rel_3.0.json

This file was deleted.

0 comments on commit 37a6c51

Please sign in to comment.