Skip to content

Commit

Permalink
Remove unittest cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jul 30, 2022
1 parent e945a1d commit 9ae4f9b
Show file tree
Hide file tree
Showing 42 changed files with 12 additions and 397 deletions.
10 changes: 1 addition & 9 deletions distutils/tests/test_archive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from distutils.spawn import find_executable, spawn
from distutils.tests import support
from test.support import run_unittest, patch
from test.support import patch
from .unix_compat import require_unix_id, require_uid_0, grp, pwd, UID_0_SUPPORT

from .py38compat import change_cwd
Expand Down Expand Up @@ -411,11 +411,3 @@ def test_tarfile_root_owner(self):
self.assertEqual(member.gid, 0)
finally:
archive.close()


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(ArchiveUtilTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_bdist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Tests for distutils.command.bdist."""
import os
import unittest
from test.support import run_unittest
import warnings

from distutils.command.bdist import bdist
Expand Down Expand Up @@ -60,11 +59,3 @@ def test_skip_build(self):
self.assertTrue(
subcmd.skip_build, '%s should take --skip-build from bdist' % name
)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildTestCase)


if __name__ == '__main__':
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_bdist_dumb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import sys
import zipfile
import unittest
from test.support import run_unittest

from distutils.core import Distribution
from distutils.command.bdist_dumb import bdist_dumb
Expand Down Expand Up @@ -97,11 +96,3 @@ def test_simple_built(self):
if not sys.dont_write_bytecode:
wanted.append('foo.%s.pyc' % sys.implementation.cache_tag)
self.assertEqual(contents, sorted(wanted))


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildDumbTestCase)


if __name__ == '__main__':
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_bdist_msi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Tests for distutils.command.bdist_msi."""
import sys
import unittest
from test.support import run_unittest
from distutils.tests import support

from .py38compat import check_warnings
Expand All @@ -19,11 +18,3 @@ def test_minimal(self):
with check_warnings(("", DeprecationWarning)):
cmd = bdist_msi(dist)
cmd.ensure_finalized()


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BDistMSITestCase)


if __name__ == '__main__':
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_bdist_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import unittest
import sys
import os
from test.support import run_unittest

from distutils.core import Distribution
from distutils.command.bdist_rpm import bdist_rpm
Expand Down Expand Up @@ -150,11 +149,3 @@ def test_no_optimize_flag(self):
)

os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildRpmTestCase)


if __name__ == '__main__':
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_bdist_wininst.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
import platform
import unittest
from test.support import run_unittest

from .py38compat import check_warnings

Expand Down Expand Up @@ -36,11 +35,3 @@ def test_get_exe_bytes(self):
# no matter what platform we have
exe_file = cmd.get_exe_bytes()
self.assertGreater(len(exe_file), 10)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildWinInstTestCase)


if __name__ == '__main__':
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import unittest
import os
import sys
from test.support import run_unittest

from distutils.command.build import build
from distutils.tests import support
Expand Down Expand Up @@ -45,11 +44,3 @@ def test_finalize_options(self):

# executable is os.path.normpath(sys.executable)
self.assertEqual(cmd.executable, os.path.normpath(sys.executable))


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
10 changes: 1 addition & 9 deletions distutils/tests/test_build_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import sys

from test.support import run_unittest, missing_compiler_executable
from test.support import missing_compiler_executable

from distutils.command.build_clib import build_clib
from distutils.errors import DistutilsSetupError
Expand Down Expand Up @@ -134,11 +134,3 @@ def test_run(self):

# let's check the result
self.assertIn('libfoo.a', os.listdir(build_temp))


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildCLibTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
11 changes: 0 additions & 11 deletions distutils/tests/test_build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,3 @@ def build_ext(self, *args, **kwargs):
build_ext = super().build_ext(*args, **kwargs)
build_ext.parallel = True
return build_ext


def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(BuildExtTestCase))
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(ParallelBuildExtTestCase))
return suite


if __name__ == '__main__':
support.run_unittest(__name__)
9 changes: 0 additions & 9 deletions distutils/tests/test_build_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from unittest.mock import patch

from distutils.tests import support
from test.support import run_unittest


class BuildPyTestCase(
Expand Down Expand Up @@ -208,11 +207,3 @@ def _trap(msg, *args):

cmd.run()
# Test should complete successfully with no exception


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildPyTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_build_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from distutils import sysconfig

from distutils.tests import support
from test.support import run_unittest


class BuildScriptsTestCase(
Expand Down Expand Up @@ -108,11 +107,3 @@ def test_version_int(self):
built = os.listdir(target)
for name in expected:
self.assertIn(name, built)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(BuildScriptsTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import textwrap
import unittest
from test.support import run_unittest

from distutils.command.check import check, HAS_DOCUTILS
from distutils.tests import support
Expand Down Expand Up @@ -199,11 +198,3 @@ def test_check_all(self):
self.assertRaises(
DistutilsSetupError, self._run, {}, **{'strict': 1, 'restructuredtext': 1}
)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(CheckTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from distutils.command.clean import clean
from distutils.tests import support
from test.support import run_unittest


class cleanTestCase(support.TempdirManager, support.LoggingSilencer, unittest.TestCase):
Expand Down Expand Up @@ -45,11 +44,3 @@ def test_simple_run(self):
cmd.all = 1
cmd.ensure_finalized()
cmd.run()


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(cleanTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
10 changes: 1 addition & 9 deletions distutils/tests/test_cmd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for distutils.cmd."""
import unittest
import os
from test.support import captured_stdout, run_unittest
from test.support import captured_stdout

from distutils.cmd import Command
from distutils.dist import Distribution
Expand Down Expand Up @@ -122,11 +122,3 @@ def test_debug_print(self):
self.assertEqual(stdout.read(), 'xxx\n')
finally:
debug.DEBUG = False


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(CommandTestCase)


if __name__ == '__main__':
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from distutils.log import WARN

from distutils.tests import support
from test.support import run_unittest

PYPIRC = """\
[distutils]
Expand Down Expand Up @@ -146,11 +145,3 @@ def test_config_interpolation(self):
('username', 'cbiggles'),
]
self.assertEqual(config, waited)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(PyPIRCCommandTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
10 changes: 1 addition & 9 deletions distutils/tests/test_config_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest
import os
import sys
from test.support import run_unittest, missing_compiler_executable
from test.support import missing_compiler_executable

from distutils.command.config import dump_file, config
from distutils.tests import support
Expand Down Expand Up @@ -90,11 +90,3 @@ def test_clean(self):

for f in (f1, f2):
self.assertFalse(os.path.exists(f))


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(ConfigTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
10 changes: 1 addition & 9 deletions distutils/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import shutil
import sys
from test.support import captured_stdout, run_unittest
from test.support import captured_stdout
from . import py38compat as os_helper
import unittest
from distutils.tests import support
Expand Down Expand Up @@ -155,11 +155,3 @@ def test_debug_mode(self):
stdout.seek(0)
wanted = "options (after parsing config files):\n"
self.assertEqual(stdout.readlines()[0], wanted)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(CoreTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import unittest
import sys
import os
from test.support import run_unittest

from distutils.cygwinccompiler import (
check_config_h,
Expand Down Expand Up @@ -120,11 +119,3 @@ def test_get_msvcr(self):
'2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' '[MSC v.2000 32 bits (Intel)]'
)
self.assertRaises(ValueError, get_msvcr)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(CygwinCCompilerTestCase)


if __name__ == '__main__':
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_dep_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from distutils.dep_util import newer, newer_pairwise, newer_group
from distutils.errors import DistutilsFileError
from distutils.tests import support
from test.support import run_unittest


class DepUtilTestCase(support.TempdirManager, unittest.TestCase):
Expand Down Expand Up @@ -68,11 +67,3 @@ def test_newer_group(self):
self.assertFalse(newer_group([one, two, old_file], three, missing='ignore'))

self.assertTrue(newer_group([one, two, old_file], three, missing='newer'))


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(DepUtilTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
9 changes: 0 additions & 9 deletions distutils/tests/test_dir_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from distutils import log
from distutils.tests import support
from test.support import run_unittest


class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
Expand Down Expand Up @@ -134,11 +133,3 @@ def test_copy_tree_exception_in_listdir(self):
):
src = self.tempdirs[-1]
dir_util.copy_tree(src, None)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(DirUtilTestCase)


if __name__ == "__main__":
run_unittest(test_suite())
Loading

0 comments on commit 9ae4f9b

Please sign in to comment.