Skip to content

Commit

Permalink
fix: Improve smoke test organization (#93)
Browse files Browse the repository at this point in the history
* Fix and improve how to handle error message and error code
* Improve the auto completion, including the way it handles --file
* Move the makim files for tests to ./tests/smoke
  • Loading branch information
xmnlab committed Feb 9, 2024
1 parent 69ec1f9 commit 5da1064
Show file tree
Hide file tree
Showing 31 changed files with 338 additions and 153 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ jobs:
brew install gnu-sed
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bash_profile
gsed -i s:/tmp:/private/tmp:g tests/.makim-working-directory-absolute-path.yaml
gsed -i s:/tmp:/private/tmp:g tests/.makim-working-directory-no-path.yaml
gsed -i s:/tmp:/private/tmp:g tests/.makim-working-directory-relative-path.yaml
gsed -i s:/tmp:/private/tmp:g tests/smoke/.makim-working-directory-absolute-path.yaml
gsed -i s:/tmp:/private/tmp:g tests/smoke/.makim-working-directory-no-path.yaml
gsed -i s:/tmp:/private/tmp:g tests/smoke/.makim-working-directory-relative-path.yaml
- name: Prepare conda environment (windows)
if: ${{ matrix.os == 'windows' }}
Expand All @@ -86,7 +86,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
miniforge-version: latest
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: makim
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:

- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
miniforge-version: latest
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: makim
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
miniforge-version: latest
environment-file: conda/release.yaml
channels: conda-forge,nodefaults
activate-environment: makim
Expand Down
54 changes: 37 additions & 17 deletions .makim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ groups:
type: bool
action: store_true
env:
MAKIM_FILE: ./tests/.makim-simple.yaml
MAKIM_FILE: ./tests/smoke/.makim-simple.yaml
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
Expand All @@ -111,7 +111,7 @@ groups:
complex:
help: Test makim using a complex makimfile
env:
MAKIM_FILE: ./tests/.makim-complex.yaml
MAKIM_FILE: ./tests/smoke/.makim-complex.yaml
args:
verbose-mode:
help: Run the all the tests in verbose mode
Expand Down Expand Up @@ -155,7 +155,8 @@ groups:
containers:
help: Test makim with containers-sugar
env:
MAKIM_FILE: .makim-complex.yaml
# it change the directory first to tests/smoke
MAKIM_FILE: .makim-sugar.yaml
args:
verbose-mode:
help: Run the all the tests in verbose mode
Expand All @@ -164,18 +165,20 @@ groups:
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
cd ./tests/
cd ./tests/smoke
makim $VERBOSE_FLAG --file $MAKIM_FILE containers.run
shell-app:
help: Test makim with working-directory for global no-path and its various combinations with group and target working-directory
help: |
Test makim with working-directory for global no-path and its various
combinations with group and target working-directory
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/.makim-interpreters.yaml
MAKIM_FILE: tests/smoke/.makim-interpreters.yaml
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
Expand All @@ -190,7 +193,7 @@ groups:
type: bool
action: store_true
env:
MAKIM_FILE: ./tests/.makim-unittest.yaml
MAKIM_FILE: ./tests/smoke/.makim-unittest.yaml
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
Expand All @@ -213,7 +216,7 @@ groups:
type: bool
action: store_true
env:
MAKIM_FILE: ./tests/.makim-env.yaml
MAKIM_FILE: ./tests/smoke/.makim-env.yaml
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
Expand All @@ -239,20 +242,21 @@ groups:
action: store_true
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file tests/.makim-bash-main-scope.yaml main-scope.test
makim $VERBOSE_FLAG --file tests/.makim-bash-group-scope.yaml group-scope.test
makim $VERBOSE_FLAG --file tests/.makim-bash-target-scope.yaml target-scope.test
makim $VERBOSE_FLAG --file tests/smoke/.makim-bash-main-scope.yaml main-scope.test
makim $VERBOSE_FLAG --file tests/smoke/.makim-bash-group-scope.yaml group-scope.test
makim $VERBOSE_FLAG --file tests/smoke/.makim-bash-target-scope.yaml target-scope.test
working-directory-absolute-path:
help: |
Test makim with working-directory absolute for global path and its various combinations with group and target working-directory
Test makim with working-directory absolute for global path and its various
combinations with group and target working-directory
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/.makim-working-directory-absolute-path.yaml
MAKIM_FILE: tests/smoke/.makim-working-directory-absolute-path.yaml
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
Expand All @@ -269,14 +273,16 @@ groups:
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.target-relative
working-directory-no-path:
help: Test makim with working-directory for global no-path and its various combinations with group and target working-directory
help: |
Test makim with working-directory for global no-path and its
various combinations with group and target working-directory
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/.makim-working-directory-no-path.yaml
MAKIM_FILE: tests/smoke/.makim-working-directory-no-path.yaml
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
Expand All @@ -295,14 +301,16 @@ groups:
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.target-relative
working-directory-relative-path:
help: Test makim with working-directory for global no-path and its various combinations with group and target working-directory
help: |
Test makim with working-directory for global no-path and its various
combinations with group and target working-directory
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/.makim-working-directory-relative-path.yaml
MAKIM_FILE: tests/smoke/.makim-working-directory-relative-path.yaml
shell: bash
run: |
export VERBOSE_FLAG='{{ "--verbose" if args.verbose_mode else "" }}'
Expand All @@ -320,3 +328,15 @@ groups:
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.target-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.target-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.target-relative
error:
help: This group helps tests failure targets
targets:
python-assert:
help: Raise an system error
shell: python
run: assert False, "Failed"
code-3:
help: Raise an system error
shell: bash
run: exit 3
100 changes: 89 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ pyyaml = ">=5.0"
jinja2 = ">=2.0"
xonsh = ">=0.14.0"
python-dotenv = ">=0.21.1"
colorama = ">=0.4.6"
typer = ">=0.9.0"
fuzzywuzzy = ">=0.18.0"
python-levenshtein = ">=0.23.0"
rich = ">=13.7.0"
shellingham = ">=1.5.4"

[tool.poetry.group.dev.dependencies]
containers-sugar = "1.9.0"
containers-sugar = "1.11.1"
pytest = ">=7"
pre-commit = ">=3"
mypy = ">=1"
Expand Down Expand Up @@ -69,7 +70,6 @@ ignore_missing_imports = true
line-length = 79
force-exclude = true
src = ["./src/makim", "./tests"]
ignore = ["RUF012"]
exclude = [
"docs",
]
Expand All @@ -86,6 +86,7 @@ select = [
"I001", # isort
"I002", # isort
]
ignore = ["RUF012"]

[tool.ruff.lint.pydocstyle]
convention = "numpy"
Expand Down
Loading

0 comments on commit 5da1064

Please sign in to comment.