-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from oda-hub/unit-tests
Unit tests
- Loading branch information
Showing
9 changed files
with
162 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
gitlab | ||
github | ||
redmine | ||
bugfix | ||
hotfix | ||
bugfixes | ||
mattermost | ||
calver | ||
astro | ||
codecov | ||
Volodymyr | ||
Savchenko | ||
Tramacere | ||
Versoix | ||
Chemin | ||
cdci | ||
antares | ||
config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Prose Linting | ||
on: [push] | ||
|
||
jobs: | ||
prose: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Vale | ||
uses: errata-ai/vale-action@v1.2.0 | ||
with: | ||
# Optional | ||
styles: | | ||
https://github.com/errata-ai/Microsoft/releases/latest/download/Microsoft.zip | ||
https://github.com/errata-ai/write-good/releases/latest/download/write-good.zip | ||
# Optional | ||
config: https://raw.githubusercontent.com/errata-ai/vale/master/.vale.ini | ||
|
||
# Optional | ||
files: '["README.md"]' | ||
env: | ||
# Required | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
|
||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest mypy pylint coverage | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics || echo "failed lint" | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics || echo "failed second lint" | ||
- name: PyLint - more lint | ||
run: | | ||
pylint -E dispatcher_plugin_antares || echo 'this is fine!' | ||
- name: MyPy | ||
run: | | ||
mypy dispatcher_plugin_antares --ignore-missing-imports || echo 'this is fine too!' | ||
- name: Test with pytest | ||
run: | | ||
python -m coverage run --source=dispatcher_plugin_antares -m pytest tests -sv --full-trace --log-cli-level=DEBUG | ||
# I wonder how this interacts with the Github App. But this is not only for PR. Also this does not always work | ||
- name: Codecov | ||
uses: codecov/codecov-action@v1.3.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
ANTARES cdci plugin | ||
ANTARES ODA plugin | ||
========================================== | ||
*ANTARES plugin for cdci_data_analysis* | ||
|
||
|
||
What's the license? | ||
------------------- | ||
|
||
ANTARES cdci plugin is distributed under the terms of The MIT License. | ||
ANTARES plugin is distributed under the terms of The MIT License. | ||
|
||
Who's responsible? | ||
------------------- | ||
Andrea Tramacere | ||
Denys Savchenko, Andrea Tramacere | ||
|
||
ISDC Data Centre for Astrophysics, Astronomy Department of the University of Geneva, Chemin d'Ecogia 16, CH-1290 Versoix, Switzerland | ||
Astronomy Department of the University of Geneva, Chemin d'Ecogia 16, CH-1290 Versoix, Switzerland | ||
|
||
Configuration for deployment | ||
---------------------------- | ||
- copy the conf_file from 'cdci_antares_plugin/config_dir/data_server_conf.yml' and place in given directory | ||
- set the env var `CDCI_ANTARES_PLUGIN_CONF_FILE` to the path of the file conf_file | ||
- edit the in conf_file the two keys: | ||
- copy the `conf_file` from `dispatcher_plugin_antares/config_dir/data_server_conf.yml' and place in given directory | ||
- set the environment variable `CDCI_ANTARES_PLUGIN_CONF_FILE` to the path of the file conf_file | ||
- edit the in `conf_file` the key: | ||
- `data_server_url:` | ||
|
||
these two keys must correspond to those in the antares-backend conf_file ie: | ||
|
||
- `data_server_url:` -> `url:` | ||
|
||
respectively |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
cdci_data_analysis | ||
#pandas | ||
# move to master or pypi later | ||
-e git+https://github.com/oda-hub/dispatcher-app@reusable-fixture#egg=cdci_data_analysis | ||
astropy | ||
simple_logger | ||
numpy | ||
numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# we could make a plugin, but it's more effort | ||
|
||
from cdci_data_analysis.pytest_fixtures import ( | ||
dispatcher_live_fixture, | ||
dispatcher_test_conf, | ||
app | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import requests | ||
import time | ||
import json | ||
import logging | ||
|
||
import pytest | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
default_params = dict( | ||
query_status="new", | ||
query_type="Real", | ||
instrument="antares", | ||
product_type="antares_spectrum", | ||
T1="2008-03-19T06:11:11.0", | ||
T2="2008-03-19T06:12:11.0", | ||
async_dispatcher=False, | ||
) | ||
|
||
def test_discover_plugin(): | ||
import cdci_data_analysis.plugins.importer as importer | ||
|
||
assert 'dispatcher_plugin_antares' in importer.cdci_plugins_dict.keys() | ||
|
||
|
||
@pytest.mark.xfail | ||
def test_default(dispatcher_live_fixture): | ||
server = dispatcher_live_fixture | ||
|
||
logger.info("constructed server: %s", server) | ||
c = requests.get(server + "/run_analysis", | ||
params = default_params) | ||
|
||
logger.info("content: %s", c.text) | ||
jdata = c.json() | ||
logger.info(json.dumps(jdata, indent=4, sort_keys=True)) | ||
logger.info(jdata) | ||
assert c.status_code == 200 | ||
|
||
assert jdata['job_status'] == 'done' | ||
|
||
|