summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests/test_test.py')
-rw-r--r--setuptools/tests/test_test.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py
new file mode 100644
index 00000000..8b8d9e6c
--- /dev/null
+++ b/setuptools/tests/test_test.py
@@ -0,0 +1,41 @@
+import pytest
+from jaraco import path
+
+from setuptools.command.test import test
+from setuptools.dist import Distribution
+
+from .textwrap import DALS
+
+
+@pytest.mark.usefixtures('tmpdir_cwd')
+def test_tests_are_run_once(capfd):
+ params = dict(
+ name='foo',
+ packages=['dummy'],
+ )
+ files = {
+ 'setup.py':
+ 'from setuptools import setup; setup('
+ + ','.join(f'{name}={params[name]!r}' for name in params)
+ + ')',
+ 'dummy': {
+ '__init__.py': '',
+ 'test_dummy.py': DALS(
+ """
+ import unittest
+ class TestTest(unittest.TestCase):
+ def test_test(self):
+ print('Foo')
+ """
+ ),
+ },
+ }
+ path.build(files)
+ dist = Distribution(params)
+ dist.script_name = 'setup.py'
+ cmd = test(dist)
+ cmd.ensure_finalized()
+ cmd.run()
+ out, err = capfd.readouterr()
+ assert out.endswith('Foo\n')
+ assert len(out.split('Foo')) == 2