diff --git a/tests/test_bisect.py b/tests/test_bisect.py index 898e28f89..f6f21cc45 100644 --- a/tests/test_bisect.py +++ b/tests/test_bisect.py @@ -1,5 +1,3 @@ -import unittest - from monty.bisect import find_ge, find_gt, find_le, find_lt, index @@ -12,7 +10,3 @@ def test_funcs(self): assert find_le(l, 1) == 1 assert find_ge(l, 2) == 2 # assert index([0, 1, 1.5, 2], 1.501, atol=0.1) == 4 - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_design_patterns.py b/tests/test_design_patterns.py index d6ded8160..f8d179f44 100644 --- a/tests/test_design_patterns.py +++ b/tests/test_design_patterns.py @@ -1,5 +1,3 @@ -import unittest - from monty.design_patterns import cached_class, singleton @@ -43,7 +41,3 @@ def test_cached_class(self): # a = A(2) # o = pickle.dumps(a) # assert a == pickle.loads(o) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_dev.py b/tests/test_dev.py index 2309e4576..e21664824 100644 --- a/tests/test_dev.py +++ b/tests/test_dev.py @@ -137,7 +137,3 @@ def test_get_ncpus(self): def test_install_except_hook(self): install_excepthook() - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_fnmatch.py b/tests/test_fnmatch.py index 1a5fdb735..2977a5bfd 100644 --- a/tests/test_fnmatch.py +++ b/tests/test_fnmatch.py @@ -1,5 +1,3 @@ -import unittest - from monty.fnmatch import WildCard @@ -8,7 +6,3 @@ def test_match(self): wc = WildCard("*.pdf") assert wc.match("A.pdf") assert not wc.match("A.pdg") - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_fractions.py b/tests/test_fractions.py index 3c4be41a2..0f9a82470 100644 --- a/tests/test_fractions.py +++ b/tests/test_fractions.py @@ -1,5 +1,3 @@ -import unittest - import pytest from monty.fractions import gcd, gcd_float, lcm @@ -15,7 +13,3 @@ def test_lcm(self): def test_gcd_float(self): vs = [6.2, 12.4, 15.5 + 5e-9] assert gcd_float(vs, 1e-8) == pytest.approx(3.1) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_inspect.py b/tests/test_inspect.py index 2d2173926..1f752d17a 100644 --- a/tests/test_inspect.py +++ b/tests/test_inspect.py @@ -1,5 +1,3 @@ -import unittest - from monty.inspect import all_subclasses, caller_name, find_top_pyfile @@ -27,7 +25,3 @@ def test_func(self): def test_all_subclasses(self): assert all_subclasses(LittleCatA) == [LittleCatB, LittleCatD] - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_io.py b/tests/test_io.py index 6f07008e0..6967bc914 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -144,7 +144,3 @@ def test_raise(self): def teardown_method(self): self.lock.release() - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_json.py b/tests/test_json.py index 135ae2b2f..a2cbfed10 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -5,7 +5,6 @@ import json import os import pathlib -import unittest from enum import Enum import numpy as np @@ -710,7 +709,3 @@ def test_dataclass(self): str_ = json.dumps(ndc, cls=MontyEncoder) ndc2 = json.loads(str_, cls=MontyDecoder) assert isinstance(ndc2, NestedDataClass) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_logging.py b/tests/test_logging.py index d3819b4f3..0ac178da5 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -1,5 +1,4 @@ import logging -import unittest from io import StringIO from monty.logging import logged @@ -15,7 +14,3 @@ def test_logged(self): s = StringIO() logging.basicConfig(level=logging.DEBUG, stream=s) add(1, 2) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_math.py b/tests/test_math.py index 3c5a2c3c8..293394926 100644 --- a/tests/test_math.py +++ b/tests/test_math.py @@ -1,5 +1,3 @@ -import unittest - from monty.math import nCr, nPr @@ -9,7 +7,3 @@ def test_nCr(self): def test_deprecated_property(self): assert nPr(4, 2) == 12 - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_multiprocessing.py b/tests/test_multiprocessing.py index f2b8817ca..0f90a81f5 100644 --- a/tests/test_multiprocessing.py +++ b/tests/test_multiprocessing.py @@ -15,7 +15,3 @@ def test_imap_tqdm(self): assert len(results) == 10000 assert results[0] == 0 assert results[400] == 400 - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_operator.py b/tests/test_operator.py index 014d41ea6..83a5238cd 100644 --- a/tests/test_operator.py +++ b/tests/test_operator.py @@ -1,12 +1,6 @@ -import unittest - from monty.operator import operator_from_str class TestOperator: def test_something(self): assert operator_from_str("==")(1, 1) and operator_from_str("+")(1, 1) == 2 - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_os.py b/tests/test_os.py index 5928297a6..8567e4323 100644 --- a/tests/test_os.py +++ b/tests/test_os.py @@ -1,5 +1,4 @@ import os -import unittest import pytest @@ -46,7 +45,3 @@ def test_makedirs_p(self): def teardown_method(self): os.rmdir(self.test_dir_path) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_pprint.py b/tests/test_pprint.py index 3e9febdcf..8416aac26 100644 --- a/tests/test_pprint.py +++ b/tests/test_pprint.py @@ -1,5 +1,3 @@ -import unittest - from monty.pprint import draw_tree, pprint_table @@ -35,7 +33,3 @@ def __str__(self): ) print(draw_tree(root)) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_re.py b/tests/test_re.py index 3d038cf73..487df4b2e 100644 --- a/tests/test_re.py +++ b/tests/test_re.py @@ -1,5 +1,4 @@ import os -import unittest from monty.re import regrep @@ -28,7 +27,3 @@ def test_regrep(self): ) assert len(matches["1"]) == 1 assert len(matches["3"]) == 11 - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 709f87c77..3c5018509 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -83,7 +83,3 @@ def test_mpk(self): with open("test_file.json") as f: reloaded = json.loads(f.read()) assert reloaded["test"] == 1 - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_shutil.py b/tests/test_shutil.py index 43820e069..4bf38a0b7 100644 --- a/tests/test_shutil.py +++ b/tests/test_shutil.py @@ -164,7 +164,3 @@ def test_remove_symlink_follow(self): assert not os.path.isfile(tempf) assert not os.path.isdir(tempdir) assert not os.path.islink(templink) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_string.py b/tests/test_string.py index cff05a7dc..e0dd9a079 100644 --- a/tests/test_string.py +++ b/tests/test_string.py @@ -4,7 +4,6 @@ import random import sys -import unittest from monty.string import remove_non_ascii, unicode2str @@ -21,7 +20,3 @@ def test_unicode2str(self): assert type(unicode2str("a")) == str else: assert type(unicode2str("a")) == str - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index c7a682fb6..1ffc91e69 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -1,5 +1,3 @@ -import unittest - from monty.subprocess import Command @@ -16,7 +14,3 @@ def test_command(self): sleep05.run(timeout=0.1) assert sleep05.retcode != 0 assert sleep05.killed - - -if __name__ == "__main__": - unittest.main()