From 3fcc340be2fc56fc1d3efbc31fe78b29459ff299 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Tue, 9 Apr 2024 14:00:12 +0200 Subject: [PATCH] remove outdated if __name__ == "__main__": unittest.main() not needed for pytest --- fireworks/core/tests/test_firework.py | 4 ---- fireworks/core/tests/test_launchpad.py | 4 ---- fireworks/core/tests/test_rocket.py | 4 ---- fireworks/core/tests/test_tracker.py | 4 ---- fireworks/scripts/lpad_run.py | 2 +- fireworks/tests/master_tests.py | 4 ---- fireworks/tests/mongo_tests.py | 4 ---- fireworks/tests/multiprocessing_tests.py | 4 ---- fireworks/tests/test_fw_config.py | 4 ---- fireworks/user_objects/firetasks/tests/test_dataflow_tasks.py | 4 ---- fireworks/user_objects/firetasks/tests/test_fileio_tasks.py | 4 ---- fireworks/user_objects/firetasks/tests/test_filepad_tasks.py | 4 ---- fireworks/user_objects/firetasks/tests/test_script_task.py | 4 ---- .../user_objects/firetasks/tests/test_templatewriter_task.py | 4 ---- .../user_objects/queue_adapters/tests/test_common_adapter.py | 4 ---- fireworks/utilities/tests/test_dagflow.py | 4 ---- fireworks/utilities/tests/test_filepad.py | 4 ---- fireworks/utilities/tests/test_fw_serializers.py | 4 ---- fireworks/utilities/tests/test_update_collection.py | 4 ---- 19 files changed, 1 insertion(+), 73 deletions(-) diff --git a/fireworks/core/tests/test_firework.py b/fireworks/core/tests/test_firework.py index 7d77ef0b1..d9b4a0702 100644 --- a/fireworks/core/tests/test_firework.py +++ b/fireworks/core/tests/test_firework.py @@ -165,7 +165,3 @@ def test_iter_len_index(self) -> None: assert len(wflow) == len(fws) assert wflow[0] == self.fw1 - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/core/tests/test_launchpad.py b/fireworks/core/tests/test_launchpad.py index 31026f8e2..7a3a6b51f 100644 --- a/fireworks/core/tests/test_launchpad.py +++ b/fireworks/core/tests/test_launchpad.py @@ -1390,7 +1390,3 @@ def test_many_detours_offline(self) -> None: launch_full = self.lp.get_launch_by_id(1) assert len(launch_full.action.detours) == 2000 - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/core/tests/test_rocket.py b/fireworks/core/tests/test_rocket.py index 5dac1fa09..42de3f11e 100644 --- a/fireworks/core/tests/test_rocket.py +++ b/fireworks/core/tests/test_rocket.py @@ -52,7 +52,3 @@ def test_postproc_exception(self) -> None: fw = self.lp.get_fw_by_id(1) assert fw.state == "FIZZLED" - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/core/tests/test_tracker.py b/fireworks/core/tests/test_tracker.py index 3914310ac..cae9a778b 100644 --- a/fireworks/core/tests/test_tracker.py +++ b/fireworks/core/tests/test_tracker.py @@ -143,7 +143,3 @@ def add_wf(j, dest, tracker, name) -> None: pwd = os.getcwd() for ldir in glob.glob(os.path.join(pwd, "launcher_*")): shutil.rmtree(ldir) - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/scripts/lpad_run.py b/fireworks/scripts/lpad_run.py index 1daa7d190..5e21cc452 100644 --- a/fireworks/scripts/lpad_run.py +++ b/fireworks/scripts/lpad_run.py @@ -771,7 +771,7 @@ def forget_offline(args: Namespace) -> None: for f in fw_ids: lp.forget_offline(f, launch_mode=False) lp.m_logger.debug(f"Processed fw_id: {f}") - lp.m_logger.info(f"Finished forget_offine, processed {len(fw_ids)} FWs") + lp.m_logger.info(f"Finished forget_offline, processed {len(fw_ids)} FWs") def report(args: Namespace) -> None: diff --git a/fireworks/tests/master_tests.py b/fireworks/tests/master_tests.py index e1dbbc3ba..a92954362 100644 --- a/fireworks/tests/master_tests.py +++ b/fireworks/tests/master_tests.py @@ -97,7 +97,3 @@ def test_recursive_deserialize(self) -> None: "defuse_children": False, } FWAction.from_dict(my_dict) - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/tests/mongo_tests.py b/fireworks/tests/mongo_tests.py index 2abaf4358..7546d8d30 100644 --- a/fireworks/tests/mongo_tests.py +++ b/fireworks/tests/mongo_tests.py @@ -608,7 +608,3 @@ def test_stats(self) -> None: launch_rocket(self.lp, self.fworker) workflow_results = s.get_workflow_summary(time_field="updated_on") assert (workflow_results[0]["_id"], workflow_results[0]["count"]) == ("COMPLETED", 3) - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/tests/multiprocessing_tests.py b/fireworks/tests/multiprocessing_tests.py index e6a0a1e8d..c37f091c6 100644 --- a/fireworks/tests/multiprocessing_tests.py +++ b/fireworks/tests/multiprocessing_tests.py @@ -118,7 +118,3 @@ def test_early_exit(self) -> None: with open(os.path.join(fw3.launches[0].launch_dir, "task.out")) as f: fw3_text = f.read() assert fw2_text != fw3_text - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/tests/test_fw_config.py b/fireworks/tests/test_fw_config.py index ab8a0ef46..6602a6584 100644 --- a/fireworks/tests/test_fw_config.py +++ b/fireworks/tests/test_fw_config.py @@ -13,7 +13,3 @@ class ConfigTest(unittest.TestCase): def test_config(self) -> None: d = config_to_dict() assert "NEGATIVE_FWID_CTR" not in d - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/user_objects/firetasks/tests/test_dataflow_tasks.py b/fireworks/user_objects/firetasks/tests/test_dataflow_tasks.py index 098213fa1..7f737a570 100644 --- a/fireworks/user_objects/firetasks/tests/test_dataflow_tasks.py +++ b/fireworks/user_objects/firetasks/tests/test_dataflow_tasks.py @@ -310,7 +310,3 @@ def test_import_data_task(self) -> None: assert "value" in root["temperature"] assert root["temperature"]["units"] == temperature["units"] os.remove(filename) - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/user_objects/firetasks/tests/test_fileio_tasks.py b/fireworks/user_objects/firetasks/tests/test_fileio_tasks.py index 81f34c0e2..eff1c1e98 100644 --- a/fireworks/user_objects/firetasks/tests/test_fileio_tasks.py +++ b/fireworks/user_objects/firetasks/tests/test_fileio_tasks.py @@ -63,7 +63,3 @@ def test_archive_dir(self) -> None: def tearDown(self) -> None: os.chdir(self.cwd) - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/user_objects/firetasks/tests/test_filepad_tasks.py b/fireworks/user_objects/firetasks/tests/test_filepad_tasks.py index 7b807a681..831246fef 100644 --- a/fireworks/user_objects/firetasks/tests/test_filepad_tasks.py +++ b/fireworks/user_objects/firetasks/tests/test_filepad_tasks.py @@ -256,7 +256,3 @@ def test_addfilesfrompatterntask_run(self) -> None: def tearDown(self) -> None: self.fp.reset() - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/user_objects/firetasks/tests/test_script_task.py b/fireworks/user_objects/firetasks/tests/test_script_task.py index f5d82c2b8..e176df0b7 100644 --- a/fireworks/user_objects/firetasks/tests/test_script_task.py +++ b/fireworks/user_objects/firetasks/tests/test_script_task.py @@ -92,7 +92,3 @@ def test_task_data_flow(self) -> None: action = PyTask(**params).run_task(spec) assert action.update_spec["first"] == 1 assert action.update_spec["second"] == 2 - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/user_objects/firetasks/tests/test_templatewriter_task.py b/fireworks/user_objects/firetasks/tests/test_templatewriter_task.py index 6f2b40f20..4adbf0ba8 100644 --- a/fireworks/user_objects/firetasks/tests/test_templatewriter_task.py +++ b/fireworks/user_objects/firetasks/tests/test_templatewriter_task.py @@ -35,7 +35,3 @@ def test_task(self) -> None: os.remove("out_template.txt") if os.path.exists("test_template.txt"): os.remove("test_template.txt") - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/user_objects/queue_adapters/tests/test_common_adapter.py b/fireworks/user_objects/queue_adapters/tests/test_common_adapter.py index 6f89c0cb5..5c4468483 100644 --- a/fireworks/user_objects/queue_adapters/tests/test_common_adapter.py +++ b/fireworks/user_objects/queue_adapters/tests/test_common_adapter.py @@ -119,7 +119,3 @@ def test_override(self) -> None: assert p._get_status_cmd("my_name") == ["my_qstatus", "-u", "my_name"] assert p.q_commands["PBS"]["submit_cmd"] == "my_qsubmit" - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/utilities/tests/test_dagflow.py b/fireworks/utilities/tests/test_dagflow.py index a2b94d551..8509db812 100644 --- a/fireworks/utilities/tests/test_dagflow.py +++ b/fireworks/utilities/tests/test_dagflow.py @@ -175,7 +175,3 @@ def test_dagflow_view(self) -> None: dagf.to_dot(filename, view="controlflow") assert os.path.exists(filename) os.remove(filename) - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/utilities/tests/test_filepad.py b/fireworks/utilities/tests/test_filepad.py index f2d628f1e..60308981d 100644 --- a/fireworks/utilities/tests/test_filepad.py +++ b/fireworks/utilities/tests/test_filepad.py @@ -57,7 +57,3 @@ def test_update_file_by_id(self) -> None: def tearDown(self) -> None: self.fp.reset() - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/utilities/tests/test_fw_serializers.py b/fireworks/utilities/tests/test_fw_serializers.py index a317874bb..828181950 100644 --- a/fireworks/utilities/tests/test_fw_serializers.py +++ b/fireworks/utilities/tests/test_fw_serializers.py @@ -143,7 +143,3 @@ def setUp(self) -> None: def test_explicit_serialization(self) -> None: assert load_object(self.s_dict) == self.s_obj - - -if __name__ == "__main__": - unittest.main() diff --git a/fireworks/utilities/tests/test_update_collection.py b/fireworks/utilities/tests/test_update_collection.py index 620694bf1..44d95b4bf 100644 --- a/fireworks/utilities/tests/test_update_collection.py +++ b/fireworks/utilities/tests/test_update_collection.py @@ -44,7 +44,3 @@ def test_update_path(self) -> None: assert test_doc["foo_list"][1]["foo2"] == "foo/new/path/bar" test_doc_archived = self.lp.db[f"test_coll_xiv_{datetime.date.today()}"].find_one() assert test_doc_archived["foo_list"][1]["foo2"] == "foo/old/path/bar" - - -if __name__ == "__main__": - unittest.main()