Skip to content

Commit

Permalink
Run tests on deploy (#322)
Browse files Browse the repository at this point in the history
Mic-4381/Run tests on deploy

Run tests on deploy
- *Category*: Release
- *JIRA issue*: [MIC-4381](https://jira.ihme.washington.edu/browse/MIC-4381)

Changes and notes
-Run tests on deploy

Testing
Will check with next release.
  • Loading branch information
albrja committed Sep 25, 2023
1 parent e553b25 commit 70c7a6d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
python --version
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Test
run: |
pip install .[test]
pytest --runslow ./tests
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
18 changes: 18 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@
from loguru import logger


def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")


def pytest_configure(config):
config.addinivalue_line("markers", "slow: mark test as slow to run")


def pytest_collection_modifyitems(config, items):
if config.getoption("--runslow"):
# --runslow given in cli: do not skip slow tests
return
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)


@pytest.fixture
def caplog(_caplog):
class PropogateHandler(logging.Handler):
Expand Down

0 comments on commit 70c7a6d

Please sign in to comment.