-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit tests #4
Unit tests #4
Changes from all commits
729009c
210875f
8f5cd11
50b6e7d
d467e0e
4536934
d83e79b
b226e22
aab9bb0
822b85a
020b7c2
3e38790
8d2cd74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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}} |
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 |
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 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @andriineronov I am about this line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove "ISDC Data Centre for Astrophysics," it does not exist There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could really also do these changes in a separate PR, it's not very clear if we are ok with the changes suggested here. |
||
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 |
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 |
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 | ||
) |
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' | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andriineronov should I put here Paris? APC or IPGP or something?