Skip to content

Commit

Permalink
instantiate NodeProviderDB in a test function as a global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mourginakis committed Nov 9, 2023
1 parent 9daa78f commit 9397169
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/test_node_provider_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
##############################################
## SETUP & TEST SETUP

# We're breaking the PEP8 line length limit here on purpose, it makes the
# database operations and assert statements more readable.

# We have to create this global var this as None, then assign its value in a
# marked test, because the NodeProviderDB.__init__() instantiates a
# connection pool and will fail if we try and instantiate it with fake
# credentials.
node_provider_db = None


node_provider_db = NodeProviderDB(
@pytest.mark.db
def test_init_node_provider_db():
global node_provider_db
node_provider_db = NodeProviderDB(
c.DB_HOST, c.DB_NAME, c.DB_PORT,
c.DB_USERNAME, c.DB_PASSWORD)

Expand Down

0 comments on commit 9397169

Please sign in to comment.