Skip to content

Commit 90cf5ee

Browse files
bkalashnikovbogdandm
bkalashnikov
authored andcommitted
Add coverage to CLI tests
1 parent 1fb69ae commit 90cf5ee

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

.github/actions/test/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ runs:
3030
- name: Test with pytest
3131
shell: bash
3232
run: |
33-
pytest ${{ inputs.pytest-args }} -m "not no_expected" test/
33+
pytest ${{ inputs.pytest-args }} -m "not no_expected" -n 8 test/

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ test = [
2323
"requests",
2424
"attrs",
2525
"pydantic>=1.3",
26-
"ruamel.yaml"
26+
"ruamel.yaml",
27+
"coverage"
2728
]
2829

2930
[project.scripts]
@@ -41,7 +42,6 @@ readme = { file = ['README.md'] }
4142
"*" = ['*.txt.', '*.ini', ".coveragerc", "LICENSE", "*.md"]
4243

4344
[tool.pytest.ini_options]
44-
addopts = "-n 4"
4545
testpaths = ["tests"]
4646
markers = [
4747
"no_expected: testing data has no expected value",

test/test_cli/test_script.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ def tmp_dir_cleanup():
3434
json.dump(item, f)
3535

3636
# detect script path
37-
setuptools_script = subprocess.call(["json2models"], shell=True) == 0
38-
if setuptools_script:
39-
executable = "json2models"
40-
else:
41-
python_path = sys.executable.replace('\\', '/')
42-
executable = f"{python_path} -m json_to_models"
37+
python_path = sys.executable.replace('\\', '/')
38+
executable = f"{python_path} -m coverage run -m json_to_models"
4339

4440

4541
def test_help():

0 commit comments

Comments
 (0)