Skip to content

Commit

Permalink
Merge 69b1955 into 7054628
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldemarmiesse committed Jul 31, 2019
2 parents 7054628 + 69b1955 commit 1c721e1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
25 changes: 25 additions & 0 deletions tests/test_observers/test_sql_observer_not_installed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pytest
from sacred.optional import has_sqlalchemy
from sacred.observers import SqlObserver
from sacred import Experiment


@pytest.fixture
def ex():
return Experiment('ator3000')


@pytest.mark.skipif(has_sqlalchemy, reason='We are testing the import error.')
def test_importerror_sql(ex):
with pytest.raises(ImportError):
ex.observers.append(SqlObserver.create('some_uri'))

@ex.config
def cfg():
a = {'b': 1}

@ex.main
def foo(a):
return a['b']

ex.run()
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ deps =
pytest==4.3.0
mock==2.0.0
commands =
pytest --ignore=tests/test_observers \
{posargs}
pytest {posargs}

[testenv:flake8]
basepython = python
Expand Down

0 comments on commit 1c721e1

Please sign in to comment.