Skip to content

Commit

Permalink
Merge pull request #161 from SEKOIA-IO/lv/improve_module_generator
Browse files Browse the repository at this point in the history
Improve module generation
  • Loading branch information
squioc authored Feb 13, 2025
2 parents 298ae64 + 8933b5e commit f18bea4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Lock boto3 to versions lower than 1.36
- The new integrity algorithm doesn't work with third party object storage implementations

### Fixed

- Fixed template for module generation

## 1.18.1 - 2024-12-04

### Added
Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def new_module(
extra_context={
"module_name": module_name,
"module_description": description,
"module_dir": module_name,
"module_dir": module_name.replace(" ", ""),
},
accept_hooks=not skip_hooks,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN pip install poetry

# Install dependencies
COPY poetry.lock pyproject.toml /app/
RUN poetry config virtualenvs.create false && poetry install --no-dev
RUN poetry config virtualenvs.create false && poetry install --only main

COPY . .

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
},
"description": "{{cookiecutter.module_description}}",
"name": "{{cookiecutter.module_name}}",
"slug": "{{cookiecutter.module_name.lower().replace(' ', '-')}}",
"categories": [],
"uuid": "{{ uuid4() }}",
"version": "0.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "Automation module for {{cookiecutter.module_name.capitalize()}}"
version = "0.0"
description = ""
authors = []
package-mode = false

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
Expand Down Expand Up @@ -31,4 +32,21 @@ line_length = 119
omit = [
"tests/*",
"main.py",
]
]

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = [
"tests",
]
addopts = '''
--strict-markers
--tb=short
--cov={{cookiecutter.module_name.lower().replace(" ", "_")}}_modules
--cov-branch
--cache-clear
--cov-report=html
--cov-report=term-missing:skip-covered
--cov-fail-under=5
--capture=sys
'''
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_new_module(tmp_path):
)
assert res.exit_code == 0

module_path = tmp_path.joinpath(module)
module_path = tmp_path.joinpath("MyModule") # without spaces
assert module_path.is_dir()

manifest = json.loads(module_path.joinpath("manifest.json").read_text())
Expand Down

0 comments on commit f18bea4

Please sign in to comment.