Skip to content

Commit

Permalink
Try adding many fields to invoke more database lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWells-diamond committed Dec 2, 2024
1 parent 3a2ef9e commit 45a727b
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/test_autosave.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def reset_autosave_setup_teardown():
autosave._AutosaveContext._instance = default_instance


def create_many_threads(tmp_path):
def test_create_many_threads(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

def create_pv_in_thread(name):
in_cm_event.wait()
builder.aOut(name, autosave=False)
builder.aOut(name, autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )

threads: List[threading.Thread] = []
for i in range(1,50):
Expand All @@ -46,10 +46,10 @@ def create_pv_in_thread(name):
[x.start() for x in threads]
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
[x.join() for x in threads]

def original_test_1(tmp_path):
def test_original_test_1(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -63,7 +63,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -73,7 +73,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_2(tmp_path):
def test_original_test_2(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -87,7 +87,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -97,7 +97,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_3(tmp_path):
def test_original_test_3(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -111,7 +111,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -121,7 +121,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_4(tmp_path):
def test_original_test_4(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -135,7 +135,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -145,7 +145,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_5(tmp_path):
def test_original_test_5(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -159,7 +159,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -169,7 +169,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_6(tmp_path):
def test_original_test_6(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -183,7 +183,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -193,7 +193,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_7(tmp_path):
def test_original_test_7(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -207,7 +207,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -217,7 +217,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_8(tmp_path):
def test_original_test_8(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -231,7 +231,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand All @@ -241,7 +241,7 @@ def create_pv_in_thread(name):
assert device_core.LookupRecord("PV-FROM-THREAD-BEFORE")
assert device_core.LookupRecord("PV-FROM-THREAD-DURING")

def original_test_9(tmp_path):
def test_original_test_9(tmp_path):
autosave.configure(tmp_path, DEVICE_NAME)
in_cm_event = threading.Event()

Expand All @@ -255,7 +255,7 @@ def create_pv_in_thread(name):
pv_thread_before_cm.start()
with autosave.Autosave(["VAL", "EGU"]):
in_cm_event.set()
builder.aOut("PV-FROM-CM")
builder.aOut("PV-FROM-CM", autosave=False, DRVL=1, DRVH=2, EGU="A", PREC=1, EGUF=2, EGUL=5, HOPR=10, LOPR=20, DESC="ABC", HIHI=1, HIGH=2, LOW=3, LOLO=4, ADEL=1, MDEL=2, )
pv_thread_in_cm.start()
pv_thread_in_cm.join()
pv_thread_before_cm.join()
Expand Down

0 comments on commit 45a727b

Please sign in to comment.