Skip to content

Commit

Permalink
Fix Inventory Views Tests (#236)
Browse files Browse the repository at this point in the history
This adds a quick workaround for the issues with the inventory tests
that we've been running into. This should be reverted once this
issues is fixed:
jeancochrane/pytest-flask-sqlalchemy#18

Signed-off-by: M. David Bennett <[email protected]>
  • Loading branch information
testeddoughnut authored Oct 4, 2019
1 parent 98eee7e commit ae1c409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ pytest==5.0.1
pytest-cov==2.7.1
pytest-flask==0.15.0
pytest-flask-sqlalchemy==1.0.2
pytest-mock==1.11.0
tox==3.13.2
8 changes: 7 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def test_hosts(db_session):


@pytest.fixture(scope="function")
def test_inventory_bootstrap(db_session):
def test_inventory_bootstrap(db_session, mocker):
"""Creates a test inventory environment."""

# This is to workaround the race condition outlined in this issue:
# https://github.com/jeancochrane/pytest-flask-sqlalchemy/issues/18
# Seems to only really bite us with the inventory tests, so just putting
# here.
mocker.patch.object(db_session, "remove", lambda: None)
return inventory.test_inventory_bootstrap()

0 comments on commit ae1c409

Please sign in to comment.