Skip to content

Commit

Permalink
Merge pull request #791 from openego/fix/#514-catch-unique-violation-…
Browse files Browse the repository at this point in the history
…tests

Fix/#514 catch unique violation tests
  • Loading branch information
nesnoj committed Jun 1, 2022
2 parents dd1fd83 + e7505a7 commit 96394b9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/egon/data/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,18 @@ def check_db_unique_violation(func):
>>> @check_db_unique_violation
... def commit_something_to_database():
... # commit something here
... return
...
>>> commit_something_to_database()
>>> commit_something_to_database() # doctest: +SKIP
Examples
--------
Add new bus to eTraGo's bus table:
>>> from egon.data import db
... from egon.data.datasets.etrago_setup import EgonPfHvBus
>>> from egon.data.datasets.etrago_setup import EgonPfHvBus
...
... @check_db_unique_violation
>>> @check_db_unique_violation
... def add_etrago_bus():
... bus_id = db.next_etrago_id("bus")
... with db.session_scope() as session:
Expand All @@ -298,7 +299,7 @@ def check_db_unique_violation(func):
... )
... session.commit()
...
>>> add_etrago_bus()
>>> add_etrago_bus() # doctest: +SKIP
Parameters
----------
Expand Down

0 comments on commit 96394b9

Please sign in to comment.