Skip to content

Commit

Permalink
Merge pull request #332 from marrink-lab/GH_actions
Browse files Browse the repository at this point in the history
Implement GH actions
  • Loading branch information
fgrunewald authored Jan 28, 2021
2 parents b0f49b5 + 81d9db7 commit 6ccc2d2
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 100 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 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: test package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
VERMOUTH_TEST_DSSP: mkdssp
SKIP_GENERATE_AUTHORS: 1
SKIP_WRITE_GIT_CHANGELOG: 1

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
py_version: ["3.6", "3.7", "3.8", "3.9", "3.6-dev", "3.7-dev", "3.8-dev", "3.9-dev"]
include:
- py_version: "3.6"
WITH_CODECOV: true
WITH_SCIPY: true
- py_version: "3.7"
WITH_CODECOV: true
WITH_SCIPY: true
- py_version: "3.8"
WITH_CODECOV: true
WITH_SCIPY: true
- py_version: "3.9"
WITH_CODECOV: true
WITH_SCIPY: false
- py_version: "3.8-dev"
WITH_CODECOV: true
WITH_SCIPY: true
- py_version: "3.9-dev"
WITH_CODECOV: true
WITH_SCIPY: true

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.py_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py_version }}
- name: Install dependencies part I
run: |
sudo apt-get install dssp
pip install --upgrade setuptools pip
- if: ${{ matrix.WITH_SCIPY }}
name: Install scipy
run: |
pip install scipy
- name: Install package and requirements
run: |
pip install --upgrade .
pip install -r requirements-tests.txt
- name: Run pytest with codecoverage
run: |
coverage run --source=vermouth $(which pytest) -vv vermouth --hypothesis-show-statistics
coverage report --omit='*/bin/pytest'
- if: ${{ matrix.WITH_CODECOV }}
name: Report code coverage
run: |
codecov
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install --upgrade .
pip install -r requirements-tests.txt
- name: Run pylint
run: |
python run_pylint.py --disable=fixme --fail-under=8.0 vermouth
python run_pylint.py --disable=fixme --fail-under=9.5 bin/martinize2
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install --upgrade .
pip install -r requirements-docs.txt
- name: Run docs
run: |
mkdir -p doc/source/_static
sphinx-build -EnW -b html doc/source/ doc/build/html
88 changes: 0 additions & 88 deletions .travis.yml

This file was deleted.

24 changes: 12 additions & 12 deletions vermouth/tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ def handle(self, record):
self.test(record)


@pytest.fixture
def logger(request):
"""Sets up a logger at loglevel 1 and attaches a LogHandler."""
logger_ = logging.getLogger(request.function.__name__)
logger_.setLevel(1)
return logger_


@pytest.fixture(scope='module')
def handler():
"""Sets up a LogHandler"""
Expand Down Expand Up @@ -105,7 +97,7 @@ def test_get_logger(name):
st.dictionaries(KWARG_ST, st.integers(), min_size=0, max_size=5)
)
)
def test_type_adapter(logger, handler, args, type_, default_type, extra):
def test_type_adapter(handler, args, type_, default_type, extra):
"""Make sure the TypeAdapter sets the correct type attr"""
def test(record):
"""Make sure the type attribute is as expected"""
Expand All @@ -121,6 +113,8 @@ def test(record):
for key, val in extra.items():
assert getattr(record, key, None) == val

logger = logging.getLogger('test_type_adapter')
logger.setLevel(1)
logger.addHandler(handler)
logger = TypeAdapter(logger, default_type=default_type, extra=extra)
handler.set_test(test)
Expand Down Expand Up @@ -148,7 +142,7 @@ def test(record):
st.dictionaries(KWARG_ST, st.integers(), min_size=0, max_size=5)
)
)
def test_style_type_adapter(logger, handler, args, kwargs, type_, default_type, extra):
def test_style_type_adapter(handler, args, kwargs, type_, default_type, extra):
"""Make sure that if you have both a TypeAdapter and a StyleAdapter the
type you provide ends up in the right place, and that it doesn't interfere
with keyword formatting."""
Expand All @@ -165,6 +159,8 @@ def test(record):
for key, val in extra.items():
assert getattr(record, key, None) == val

logger = logging.getLogger('test_style_type_adapter')
logger.setLevel(1)
logger.addHandler(handler)
logger = TypeAdapter(logger, default_type=default_type)
logger = StyleAdapter(logger, extra=extra)
Expand All @@ -189,7 +185,7 @@ def test(record):
extra=st.one_of(st.none(),
st.dictionaries(KWARG_ST, st.integers(), min_size=0, max_size=5))
)
def test_style_adapter(logger, handler, args, kwargs, extra):
def test_style_adapter(handler, args, kwargs, extra):
"""Make sure the StyleAdapter can do keyword formatting"""
def test(record):
"""Make sure the formatting worked"""
Expand All @@ -198,6 +194,8 @@ def test(record):
for key, val in extra.items():
assert getattr(record, key, None) == val

logger = logging.getLogger('test_style_adapter')
logger.setLevel(1)
logger.addHandler(handler)
logger = StyleAdapter(logger, extra=extra)
handler.set_test(test)
Expand All @@ -213,12 +211,14 @@ def test(record):
args=st.lists(st.text(), min_size=0, max_size=5),
kwargs=st.dictionaries(KWARG_ST, st.text(), min_size=1, max_size=5),
)
def test_passing_adapter(logger, handler, args, kwargs):
def test_passing_adapter(handler, args, kwargs):
"""Make sure the PassingLoggerAdapter does not allow keywords to be set for
formatting."""
def test(_):
assert False
handler.set_test(test)
logger = logging.getLogger('test_passing_adapter')
logger.setLevel(1)
logger.addHandler(handler)
logger = PassingLoggerAdapter(logger)
fmt = ['%s']*len(args) + ['%(' + name + ')s' for name in kwargs]
Expand Down

0 comments on commit 6ccc2d2

Please sign in to comment.