Skip to content

Commit

Permalink
CI/CD replace test setup() with setup_method() (pydicom#848)
Browse files Browse the repository at this point in the history
* search and replace of def setup(self) with def setup_method(self)
search and replace of def teardown(self) with def teardown_method(self)
addresses deprecation/obsolescence issue

* replaced super().setup() with super().setup_method()
fall out from havig done global search and replace of def setup(self) with def setup_method(self)
  • Loading branch information
sjswerdloff committed Jun 22, 2023
1 parent 62d1fcf commit 78d4b95
Show file tree
Hide file tree
Showing 44 changed files with 267 additions and 267 deletions.
8 changes: 4 additions & 4 deletions pynetdicom/apps/tests/test_echoscp.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def start_echoscp_cli(args):
class EchoSCPBase:
"""Tests for echoscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.p = None
self.func = None

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -301,7 +301,7 @@ def test_flag_xi(self):
class TestEchoSCP(EchoSCPBase):
"""Tests for echoscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.p = None
Expand All @@ -311,7 +311,7 @@ def setup(self):
class TestEchoSCPCLI(EchoSCPBase):
"""Tests for echoscp using CLI"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.p = None
Expand Down
8 changes: 4 additions & 4 deletions pynetdicom/apps/tests/test_echoscu.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def start_echoscu_cli(args):
class EchoSCUBase:
"""Tests for echoscu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = None

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -539,7 +539,7 @@ def handle_abort(event):
class TestEchoSCU(EchoSCUBase):
"""Tests for echoscu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_echoscu
Expand All @@ -548,7 +548,7 @@ def setup(self):
class TestEchoSCUCLI(EchoSCUBase):
"""Tests for echoscu using CLI"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_echoscu_cli
8 changes: 4 additions & 4 deletions pynetdicom/apps/tests/test_findscu.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ def start_findscu_scli(args):
class FindSCUBase:
"""Tests for findscu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = None

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -588,7 +588,7 @@ def handle_find(event):
class TestFindSCU(FindSCUBase):
"""Tests for findscu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_findscu
Expand All @@ -597,7 +597,7 @@ def setup(self):
class TestFindSCUCLI(FindSCUBase):
"""Tests for findscu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_findscu_scli
8 changes: 4 additions & 4 deletions pynetdicom/apps/tests/test_getscu.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def start_getscu_cli(args):
class GetSCUBase:
"""Tests for getscu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = None
Expand All @@ -72,7 +72,7 @@ def setup(self):
ds.SOPInstanceUID = "1.2.3.4"
ds.PatientName = "Citizen^Jan"

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -569,7 +569,7 @@ def handle_get(event):
class TestGetSCU(GetSCUBase):
"""Tests for getscu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_getscu
Expand All @@ -585,7 +585,7 @@ def setup(self):
class TestGetSCUCLI(GetSCUBase):
"""Tests for getscu using CLI"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_getscu_cli
Expand Down
8 changes: 4 additions & 4 deletions pynetdicom/apps/tests/test_movescu.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def start_movescu_cli(args):
class MoveSCUBase:
"""Tests for movescu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = None
Expand All @@ -73,7 +73,7 @@ def setup(self):
ds.SOPInstanceUID = "1.2.3.4"
ds.PatientName = "Citizen^Jan"

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -756,7 +756,7 @@ def handle_move(event):
class TestMoveSCU(MoveSCUBase):
"""Tests for movescu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_movescu
Expand All @@ -772,7 +772,7 @@ def setup(self):
class TestMoveSCUCLI(MoveSCUBase):
"""Tests for movescu.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.func = start_movescu_cli
Expand Down
10 changes: 5 additions & 5 deletions pynetdicom/apps/tests/test_qrscp_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_create_new_existing(self):
class TestAddInstance:
"""Tests for db.add_instance()."""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
engine = db.create("sqlite:https:///:memory:")

Expand Down Expand Up @@ -302,7 +302,7 @@ def test_instance_exists(self):
class TestRemoveInstance:
"""Tests for db.remove_instance()."""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
engine = db.create("sqlite:https:///:memory:")

Expand Down Expand Up @@ -349,7 +349,7 @@ def test_remove_not_existing(self):
class TestClear:
"""Tests for db.clear()."""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
engine = db.create("sqlite:https:///:memory:")

Expand All @@ -372,7 +372,7 @@ def test_clear(self):
class TestSearch:
"""Tests for db.search()."""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
engine = db.create("sqlite:https:///:memory:")
pydicom.config.use_none_as_empty_text_VR_value = True
Expand Down Expand Up @@ -668,7 +668,7 @@ def test_combine_queries(self):
class TestSearchFind:
"""Tests for running C-FIND queries against the database."""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
engine = db.create("sqlite:https:///:memory:")
pydicom.config.use_none_as_empty_text_VR_value = True
Expand Down
12 changes: 6 additions & 6 deletions pynetdicom/apps/tests/test_qrscp_echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def start_qrscp_cli(args):
class EchoSCPBase:
"""Tests for echoscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.p = None
Expand All @@ -63,7 +63,7 @@ def setup(self):

self.startup = 1.0

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -240,9 +240,9 @@ def test_flag_log_collision(self):
class TestEchoSCP(EchoSCPBase):
"""Tests for echoscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()

self.func = start_qrscp

Expand All @@ -251,8 +251,8 @@ def setup(self):
class TestEchoSCPCLI(EchoSCPBase):
"""Tests for echoscp using CLI"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()

self.func = start_qrscp_cli
12 changes: 6 additions & 6 deletions pynetdicom/apps/tests/test_qrscp_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _send_datasets():
class FindSCPBase:
"""Tests for qrscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.p = None
Expand Down Expand Up @@ -102,7 +102,7 @@ def setup(self):

self.startup = 1.0

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -609,9 +609,9 @@ def test_sr_query(self):
class TestFindSCP(FindSCPBase):
"""Tests for qrscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()
self.ae = None
self.p = None
self.func = start_qrscp
Expand All @@ -621,9 +621,9 @@ def setup(self):
class TestFindSCPCLI(FindSCPBase):
"""Tests for qrscp using CLI"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()
self.ae = None
self.p = None
self.func = start_qrscp_cli
12 changes: 6 additions & 6 deletions pynetdicom/apps/tests/test_qrscp_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _send_datasets():
class GetSCPBase:
"""Tests for qrscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.p = None
Expand All @@ -80,7 +80,7 @@ def setup(self):

self.startup = 1.0

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -153,9 +153,9 @@ def handle_store(event):
class TestGetSCP(GetSCPBase):
"""Tests for qrscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()
self.ae = None
self.p = None
self.func = start_qrscp
Expand All @@ -165,9 +165,9 @@ def setup(self):
class TestGetSCPCLI(GetSCPBase):
"""Tests for qrscp using CLI"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()
self.ae = None
self.p = None
self.func = start_qrscp_cli
12 changes: 6 additions & 6 deletions pynetdicom/apps/tests/test_qrscp_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _send_datasets():
class MoveSCPBase:
"""Tests for qrscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
self.ae = None
self.p = None
Expand All @@ -80,7 +80,7 @@ def setup(self):

self.startup = 1.0

def teardown(self):
def teardown_method(self):
"""Clear any active threads"""
if self.ae:
self.ae.shutdown()
Expand Down Expand Up @@ -155,9 +155,9 @@ def handle_store(event):
class TestMoveSCP(MoveSCPBase):
"""Tests for qrscp.py"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()
self.ae = None
self.p = None
self.func = start_qrscp
Expand All @@ -167,9 +167,9 @@ def setup(self):
class TestMoveSCPCLI(MoveSCPBase):
"""Tests for qrscp using CLI"""

def setup(self):
def setup_method(self):
"""Run prior to each test"""
super().setup()
super().setup_method()
self.ae = None
self.p = None
self.func = start_qrscp_cli
Loading

0 comments on commit 78d4b95

Please sign in to comment.