diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..084180a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Test +on: [push, pull_request, workflow_dispatch] #workflow_dispatch works only if its active in the main branch +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - 3.7 + - 3.8 + - 3.9 + - '3.10' + name: Test on Python v${{ matrix.python-version }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + architecture: x64 + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run Tests + run: python -m pytest --cov + + - name: Submit Coverage + if: ${{ matrix.python-version == '3.10' }} + env: + GITHUB_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + run: python -m coveralls diff --git a/.gitignore b/.gitignore index b6e4761..a8bc617 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,9 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +.DS_Store + + # PyInstaller # Usually these files are written by a python script from a template diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 49efc7a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -dist: xenial -language: python -python: - - "3.7" - - "3.8" - - "3.9" -install: - - python -m pip install --upgrade pip - - python setup.py install - - python -m pip install -r requirements_test.txt -before_script: - - export PYTHONPATH=`pwd` -script: - - pytest --cov ga4gh/ --cov-report=term-missing tests/ -after_success: - - coveralls diff --git a/README.md b/README.md index 38bdd7d..f5e30ba 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,61 @@ -# ga4gh-testbed-lib +GA4GH Logo + +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0) +[![Python](https://img.shields.io/badge/python-3.7|3.8|3.9|3.10-blue.svg?style=flat-square)](https://www.python.org/) +[![GitHub Actions](https://img.shields.io/github/workflow/status/ga4gh/ga4gh-testbed-lib/Test/main?style=flat-square)](https://github.com/ga4gh/ga4gh-testbed-lib/actions) +[![Coveralls](https://img.shields.io/coveralls/github/ga4gh/ga4gh-testbed-lib/main?style=flat-square)](https://coveralls.io/github/ga4gh/ga4gh-testbed-lib) + +# GA4GH Testbed Lib + Python library for creating GA4GH testbed reports according to a harmonized, cross-workstream schema + +## Installation + +As a prerequisite, please ensure you have Python 3 installed on your machine. +`ga4gh-testbed-lib` is tested on the following Python versions: +* v3.7 +* v3.8 +* v3.9 +* v3.10 + +`ga4gh-testbed-lib` is a library that can be imported into your Python project. +To do so, first install it via `pip`: + +``` +pip install ga4gh-testbed-lib +``` + +Note: We recommend using a Python virtual environment when building any Python project to avoid dependency conflicts with other projects on your system. + +## Usage + +Once installed, you may import the `ga4gh-testbed-lib` in your Python modules. We recommend only importing the `Report` class directly: +``` +from ga4gh.testbed.report.report import Report +... +report = Report() +``` + +More documentation to come on how to use the report library + +## Test + +To contribute to the testbed library, you will need to clone the repository: +``` +git clone https://github.com/ga4gh/ga4gh-testbed-lib.git +``` + +To run tests, you will need to install test dependencies (i.e. pytest): +``` +pip install -r requirements.txt +``` + +Tests can be run via `pytest`: +``` +python -m pytest --cov +``` + +## Changelog + +### v0.1.2 +* Test level entity now has a `message` attribute for capturing test result summary in a single message diff --git a/ga4gh/testbed/report/test.py b/ga4gh/testbed/report/test.py index 9fd7ded..90418ea 100644 --- a/ga4gh/testbed/report/test.py +++ b/ga4gh/testbed/report/test.py @@ -7,7 +7,7 @@ from ga4gh.testbed.mixins.has_message import HasMessage from ga4gh.testbed.report.case import Case -class Test(HasTimestamps, HasStatus, HasSummary): +class Test(HasTimestamps, HasStatus, HasSummary, HasMessage): """A single test within the reporting hierarchy, contains multiple cases Immediate subcomponent of a test "Phase". Represents a single test with @@ -30,6 +30,7 @@ def __init__(self): self._HasTimestamps__initialize_timestamps() self._HasStatus__initialize_status() self._HasSummary__initialize_summary() + self._HasMessage__initialize_message() self.cases = [] diff --git a/requirements_test.txt b/requirements.txt similarity index 92% rename from requirements_test.txt rename to requirements.txt index b9d8cc6..1b2552a 100644 --- a/requirements_test.txt +++ b/requirements.txt @@ -3,9 +3,10 @@ bleach==4.1.0 certifi==2021.10.8 charset-normalizer==2.0.7 colorama==0.4.4 -coverage==6.0.2 +coverage==6.3.2 +coveralls==3.3.1 +docopt==0.6.2 docutils==0.18 -ga4gh-testbed-lib==0.1.0 idna==3.3 importlib-metadata==4.8.1 iniconfig==1.1.1 diff --git a/schema/ga4gh-testbed-test.json b/schema/ga4gh-testbed-test.json index cf0c2a9..c48ab4a 100644 --- a/schema/ga4gh-testbed-test.json +++ b/schema/ga4gh-testbed-test.json @@ -26,6 +26,9 @@ "summary": { "$ref": "ga4gh-testbed-summary.json#/definitions/ga4ghTestbedSummary" }, + "message": { + "type": "string" + }, "cases": { "type": "array", "items": { diff --git a/setup.py b/setup.py index 2128663..f6293fa 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import setuptools NAME = "ga4gh-testbed-lib" -VERSION = "0.1.1" +VERSION = "0.1.2" AUTHOR = "Jeremy Adams" EMAIL = "jeremy.adams@ga4gh.org" diff --git a/tests/data/e2e/report_finalization_serialization/0.json b/tests/data/e2e/report_finalization_serialization/0.json index b778786..0f15f69 100644 --- a/tests/data/e2e/report_finalization_serialization/0.json +++ b/tests/data/e2e/report_finalization_serialization/0.json @@ -48,6 +48,7 @@ "failed": 0, "skipped": 1 }, + "message": "", "cases": [ { "case_name": "Get e. coli", @@ -82,6 +83,7 @@ "failed": 0, "skipped": 0 }, + "message": "", "cases": [ { "case_name": "List bacterial sequences", @@ -132,6 +134,7 @@ "failed": 1, "skipped": 0 }, + "message": "", "cases": [ { "case_name": "Get synonymous mutation", @@ -166,6 +169,7 @@ "failed": 0, "skipped": 2 }, + "message": "", "cases": [ { "case_name": "List synonymous mutations",