Skip to content

Commit

Permalink
Test database locking
Browse files Browse the repository at this point in the history
  • Loading branch information
gerlero committed Jul 30, 2023
1 parent f5f8796 commit 4d4b1ce
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_lock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pytest

import subprocess
from time import sleep

from electrolytes import *


def test_lock_api_cli() -> None:
name = "TES7342982891"
try:
del database[name]
except KeyError:
pass

assert name not in database

database.add(Constituent(name=name,
u_neg=[2.73],
pkas_neg=[3.14]))

with database:
proc = subprocess.Popen(["electrolytes", "rm", name])
sleep(0.1)
del database[name]
proc.wait()

assert proc.returncode != 0
assert name not in database

0 comments on commit 4d4b1ce

Please sign in to comment.