Skip to content
Snippets Groups Projects
Commit 01bc61e7 authored by Enrique Garcia's avatar Enrique Garcia
Browse files

tests help for all scripts

parent f02a330b
No related branches found
No related tags found
1 merge request!5Add zenodoapi module
Pipeline #134620 passed
......@@ -17,11 +17,6 @@ install_py37:
- eossr-codemeta2zenodo --help
- eossr-codemeta2zenodo --input_codemeta_file ./codemeta.json
- cat .zenodo.json
- echo "testing all entry points and bash scripts"
- eossr-upload-new-deposit -h
- eossr-upload-new-version-deposit -h
- eossr-check-connection-zenodo -h
- which parse_last_release_git.sh
only:
- branches
......
# Various tests taken/based from
# https://github.com/cta-observatory/cta-lstchain/blob/master/lstchain/scripts/tests/test_lstchain_scripts.py
import pytest
import subprocess
import pkg_resources
from os.path import dirname, realpath, join
ROOT_DIR = dirname(realpath("codemeta.json"))
def find_entry_points(package_name):
"""from: https://stackoverflow.com/a/47383763/3838691"""
entrypoints = [
ep.name
for ep in pkg_resources.iter_entry_points("console_scripts")
if ep.module_name.startswith(package_name)
]
return entrypoints
ALL_SCRIPTS = find_entry_points("eossr")
def run_script(*args):
result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
......@@ -16,3 +34,13 @@ def run_script(*args):
def test_codemeta2zenodo():
run_script("eossr-codemeta2zenodo", "-i", join(ROOT_DIR, "codemeta.json"))
def test_parse_last_release_git_bash():
run_script("which", "parse_last_release_git.sh")
@pytest.mark.parametrize("script", ALL_SCRIPTS)
def test_help_all_scripts(script):
"""Test for all scripts if at least the help works"""
run_script(script, "--help")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment